Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.21-r13/0013-2.6.21-mm-lots_watermark.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 445 - (hide annotations) (download)
Tue Jan 15 00:44:37 2008 UTC (16 years, 4 months ago) by niro
File size: 4049 byte(s)
-added patches for 2.6.21-alx-r13

1 niro 445 The vm currently performs scanning when allocating ram once the watermarks
2     are below the pages_low value and tries to restore them to the pages_high
3     watermark. The disadvantage of this is that we are scanning most aggresssively
4     at the same time we are allocating ram regardless of the stress the vm is
5     under. Add a pages_lots watermark and allow the watermark to be relaxed
6     according to the stress the vm is at the time (according to the priority
7     value). Thus we have more in reserve next time we are allocating ram and end
8     up scanning less aggresssively. Note the actual pages_lots isn't used directly
9     in this code.
10    
11     Signed-off-by: Con Kolivas <kernel@kolivas.org>
12    
13     include/linux/mmzone.h | 2 +-
14     mm/page_alloc.c | 3 +++
15     mm/vmscan.c | 17 ++++++++++++++---
16     3 files changed, 18 insertions(+), 4 deletions(-)
17    
18     Index: linux-2.6.21-ck2/include/linux/mmzone.h
19     ===================================================================
20     --- linux-2.6.21-ck2.orig/include/linux/mmzone.h 2007-05-14 19:49:19.000000000 +1000
21     +++ linux-2.6.21-ck2/include/linux/mmzone.h 2007-05-14 19:49:55.000000000 +1000
22     @@ -178,7 +178,7 @@ enum zone_type {
23    
24     struct zone {
25     /* Fields commonly accessed by the page allocator */
26     - unsigned long pages_min, pages_low, pages_high;
27     + unsigned long pages_min, pages_low, pages_high, pages_lots;
28     /*
29     * We don't know if the memory that we're going to allocate will be freeable
30     * or/and it will be released eventually, so to avoid totally wasting several
31     Index: linux-2.6.21-ck2/mm/page_alloc.c
32     ===================================================================
33     --- linux-2.6.21-ck2.orig/mm/page_alloc.c 2007-05-14 19:49:19.000000000 +1000
34     +++ linux-2.6.21-ck2/mm/page_alloc.c 2007-05-14 19:49:55.000000000 +1000
35     @@ -1597,6 +1597,7 @@ void show_free_areas(void)
36     " min:%lukB"
37     " low:%lukB"
38     " high:%lukB"
39     + " lots:%lukB"
40     " active:%lukB"
41     " inactive:%lukB"
42     " present:%lukB"
43     @@ -1608,6 +1609,7 @@ void show_free_areas(void)
44     K(zone->pages_min),
45     K(zone->pages_low),
46     K(zone->pages_high),
47     + K(zone->pages_lots),
48     K(zone_page_state(zone, NR_ACTIVE)),
49     K(zone_page_state(zone, NR_INACTIVE)),
50     K(zone->present_pages),
51     @@ -3146,6 +3148,7 @@ void setup_per_zone_pages_min(void)
52    
53     zone->pages_low = zone->pages_min + (tmp >> 2);
54     zone->pages_high = zone->pages_min + (tmp >> 1);
55     + zone->pages_lots = zone->pages_min + tmp;
56     spin_unlock_irqrestore(&zone->lru_lock, flags);
57     }
58    
59     Index: linux-2.6.21-ck2/mm/vmscan.c
60     ===================================================================
61     --- linux-2.6.21-ck2.orig/mm/vmscan.c 2007-05-14 19:49:55.000000000 +1000
62     +++ linux-2.6.21-ck2/mm/vmscan.c 2007-05-14 19:49:55.000000000 +1000
63     @@ -1176,6 +1176,7 @@ loop_again:
64     */
65     for (i = pgdat->nr_zones - 1; i >= 0; i--) {
66     struct zone *zone = pgdat->node_zones + i;
67     + unsigned long watermark;
68    
69     if (!populated_zone(zone))
70     continue;
71     @@ -1183,8 +1184,14 @@ loop_again:
72     if (zone->all_unreclaimable && priority != DEF_PRIORITY)
73     continue;
74    
75     - if (!zone_watermark_ok(zone, order, zone->pages_high,
76     - 0, 0)) {
77     + /*
78     + * The watermark is relaxed depending on the
79     + * level of "priority" till it drops to
80     + * pages_high.
81     + */
82     + watermark = zone->pages_high + (zone->pages_high *
83     + priority / DEF_PRIORITY);
84     + if (!zone_watermark_ok(zone, order, watermark, 0, 0)) {
85     end_zone = i;
86     break;
87     }
88     @@ -1211,6 +1218,7 @@ loop_again:
89     for (i = 0; i <= end_zone; i++) {
90     struct zone *zone = pgdat->node_zones + i;
91     int nr_slab;
92     + unsigned long watermark;
93    
94     if (!populated_zone(zone))
95     continue;
96     @@ -1218,7 +1226,10 @@ loop_again:
97     if (zone->all_unreclaimable && priority != DEF_PRIORITY)
98     continue;
99    
100     - if (!zone_watermark_ok(zone, order, zone->pages_high,
101     + watermark = zone->pages_high + (zone->pages_high *
102     + priority / DEF_PRIORITY);
103     +
104     + if (!zone_watermark_ok(zone, order, watermark,
105     end_zone, 0))
106     all_zones_ok = 0;
107     temp_priority[i] = priority;