Several kernel patches by Con Kolivas to compliment BFS, adapted for 2.6.28
[kernel-bfs] / kernel-bfs-2.6.28 / debian / patches / mm-make_swappiness_really_mean_it.patch
1 Swappiness the tunable lies. It doesn't respect swappiness because it alters
2 the value when we're more than lightly loaded in the vm. Change it to -really-
3 mean swappiness unless we're about to go out of memory.
4
5 -ck
6 ---
7  mm/vmscan.c |    7 ++++++-
8  1 file changed, 6 insertions(+), 1 deletion(-)
9
10 Index: linux-2.6.34-ck1/mm/vmscan.c
11 ===================================================================
12 --- linux-2.6.34-ck1.orig/mm/vmscan.c   2010-05-18 12:24:33.974319780 +1000
13 +++ linux-2.6.34-ck1/mm/vmscan.c        2010-05-18 12:26:16.233444880 +1000
14 @@ -1633,6 +1633,7 @@ static void shrink_zone(int priority, st
15         unsigned long nr_reclaimed = 0;
16         unsigned long percent[2];       /* anon @ 0; file @ 1 */
17         enum lru_list l;
18 +       int tmp_priority;
19  
20         get_scan_ratio(zone, sc, percent);
21  
22 @@ -1648,7 +1649,11 @@ static void shrink_zone(int priority, st
23  
24                         scan = zone_page_state(zone, NR_LRU_BASE + l);
25                         if (priority) {
26 -                               scan >>= priority;
27 +                               tmp_priority = priority;
28 +
29 +                               if (file && priority > 0)
30 +                                       tmp_priority = DEF_PRIORITY;
31 +                               scan >>= tmp_priority;
32                                 scan = (scan * percent[file]) / 100;
33                         }
34                         zone->lru[l].nr_scan += scan;
35