Clean up patch dir; synchronize patches with kernel-power v48
[kernel-bfs] / kernel-bfs-2.6.28 / debian / patches / ck / mm-make_swappiness_really_mean_it.patch
1 --- linux-2.6.28/mm/vmscan.c    2008-12-25 00:26:37.000000000 +0100
2 +++ linux-2.6.28.new/mm/vmscan.c        2011-06-02 13:51:01.615325087 +0200
3 @@ -1342,13 +1342,6 @@ static void get_scan_ratio(struct zone *
4                 zone_page_state(zone, NR_INACTIVE_FILE);
5         free  = zone_page_state(zone, NR_FREE_PAGES);
6  
7 -       /* If we have no swap space, do not bother scanning anon pages. */
8 -       if (nr_swap_pages <= 0) {
9 -               percent[0] = 0;
10 -               percent[1] = 100;
11 -               return;
12 -       }
13 -
14         /* If we have very few page cache pages, force-scan anon pages. */
15         if (unlikely(file + free <= zone->pages_high)) {
16                 percent[0] = 100;
17 @@ -1416,8 +1409,16 @@ static unsigned long shrink_zone(int pri
18         unsigned long nr_reclaimed = 0;
19         unsigned long percent[2];       /* anon @ 0; file @ 1 */
20         enum lru_list l;
21 +       int tmp_priority;
22 +       int noswap = 0;
23  
24 -       get_scan_ratio(zone, sc, percent);
25 +       /* If we have no swap space, do not bother scanning anon pages. */
26 +       if (!sc->may_swap || (nr_swap_pages <= 0)) {
27 +               noswap = 1;
28 +               percent[0] = 0;
29 +               percent[1] = 100;
30 +       } else
31 +               get_scan_ratio(zone, sc, percent);
32  
33         for_each_evictable_lru(l) {
34                 if (scan_global_lru(sc)) {
35 @@ -1425,8 +1426,12 @@ static unsigned long shrink_zone(int pri
36                         int scan;
37  
38                         scan = zone_page_state(zone, NR_LRU_BASE + l);
39 -                       if (priority) {
40 -                               scan >>= priority;
41 +                       if (priority || noswap) {
42 +                               tmp_priority = priority;
43 +
44 +                               if (file && priority > 0)
45 +                                       tmp_priority = DEF_PRIORITY;
46 +                               scan >>= tmp_priority;
47                                 scan = (scan * percent[file]) / 100;
48                         }
49                         zone->lru[l].nr_scan += scan;