appling preasure to icache and dcache
Subsystems (5)
RFC PATCH 1/1 appling preasure to icache and dcache
Hi,
This patch does two things. One it applies pressure to the icache and dcache, from kswapd, when they grow or possibly become shrinkable. The idea being not to let them grow to the point that they start being the source of vm pressure - this seems to be happening with the current algorithm.
It also limits bg aging restricting it to the page inactivation rate. This perserves aging info longer preventing paging spikes after periods of low activity.
The try_shrinking_[i|d]cache functions would become much simpler if the slab cache tracked the number of pages freeable in a cache. I do not think this is a trivial task though. I have also tried to avoid making the patch depend on 'magic numbers'. As it stands DEF_PRIORITY is used but could be eliminated if the shrink_[i|d]cache_memory calls took the number of pages to free and returned the number of pages actually released. In ac28 refill_inactive_scan is already ignoring DEF_PRIORITY.
Variants of this patch have been running here, on top of ac28, over the for the last couple of days as I optimised the try_shrinking functions. Reports on how well this works under differing loads would be interesting.
Comments on style, and suggestions on how to improve this code are very welcome.
TIA
Ed Tomlinson <[email protected]>
---
mm/page_alloc.c +2 -4
@@ -138,11 +138,9 @@/* * We don't want to protect this variable from race conditions -* since it's nothing important, but we do want to make sure -* it never gets negative. +* since it's nothing important. */ -if (memory_pressure >NR_CPUS ) - memory_pressure--; + inactivate_pressure++; }#define MARK_USED (index, order, area) \
mm/swap.c +4 -1
@@ -47,10 +47,12 @@* many inactive pages we should have. * * In reclaim_page and __alloc_pages: memory_pressure++ -* In __free_pages_ok: memory_pressure-- +* In __free_pages_ok: inactivate_pressure++ +* In invalidate_pages_scan: inactivate_pressure++ * In recalculate_vm_stats the value is decayed (once a second) */ int memory_pressure; +int inactivate_pressure;/* We track the number of pages currently being asynchronously swapped out, so that we don't try to swap TOO many pages out at once */
@@ -287,6 +289,7 @@* memory_pressure. */ memory_pressure -= (memory_pressure >>INACTIVE_SHIFT ); + inactivate_pressure -= (inactivate_pressure >>INACTIVE_SHIFT ); }/*
mm/vmscan.c +89 -6
123 lines not on this page · raw message
/* Once a second, recalculate some VM stats. */ if (time_after(jiffies, recalc + HZ)) {
---
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Hi,
The patch in the last message was scrambled. The last two lines belong to the previous fragment. Here is the correct beast.
Ed Tomlinson <[email protected]
---
mm/page_alloc.c +2 -4
@@ -138,11 +138,9 @@/* * We don't want to protect this variable from race conditions -* since it's nothing important, but we do want to make sure -* it never gets negative. +* since it's nothing important. */ -if (memory_pressure >NR_CPUS ) - memory_pressure--; + inactivate_pressure++; }#define MARK_USED (index, order, area) \
mm/swap.c +4 -1
@@ -47,10 +47,12 @@* many inactive pages we should have. * * In reclaim_page and __alloc_pages: memory_pressure++ -* In __free_pages_ok: memory_pressure-- +* In __free_pages_ok: inactivate_pressure++ +* In invalidate_pages_scan: inactivate_pressure++ * In recalculate_vm_stats the value is decayed (once a second) */ int memory_pressure; +int inactivate_pressure;/* We track the number of pages currently being asynchronously swapped out, so that we don't try to swap TOO many pages out at once */
@@ -287,6 +289,7 @@* memory_pressure. */ memory_pressure -= (memory_pressure >>INACTIVE_SHIFT ); + inactivate_pressure -= (inactivate_pressure >>INACTIVE_SHIFT ); }/*
mm/vmscan.c +87 -5
117 lines not on this page · raw message
include/linux/swap.h +1 -0
@@ -102,6 +102,7 @@/* linux/mm/swap.c */ extern int memory_pressure; +extern int inactivate_pressure;extern void age_page_up (struct page *);extern void age_page_up_nolock (struct page *);extern void age_page_down (struct page *);
---
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/