Contents of /trunk/kernel26-magellan/patches-2.6.17-r6/0020-2.6.17-mm-lots_watermark.diff
Parent Directory | Revision Log
Revision 105 -
(show annotations)
(download)
Sun Mar 11 16:17:56 2007 UTC (17 years, 6 months ago) by niro
File size: 4582 byte(s)
Sun Mar 11 16:17:56 2007 UTC (17 years, 6 months ago) by niro
File size: 4582 byte(s)
2.6.17-magellan-r6
1 | 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 | 5 +++++ |
15 | mm/vmscan.c | 18 +++++++++++++++--- |
16 | 3 files changed, 21 insertions(+), 4 deletions(-) |
17 | |
18 | Index: linux-ck-dev/include/linux/mmzone.h |
19 | =================================================================== |
20 | --- linux-ck-dev.orig/include/linux/mmzone.h 2006-06-18 15:20:12.000000000 +1000 |
21 | +++ linux-ck-dev/include/linux/mmzone.h 2006-06-18 15:25:00.000000000 +1000 |
22 | @@ -123,7 +123,7 @@ struct per_cpu_pageset { |
23 | struct zone { |
24 | /* Fields commonly accessed by the page allocator */ |
25 | unsigned long free_pages; |
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-ck-dev/mm/page_alloc.c |
32 | =================================================================== |
33 | --- linux-ck-dev.orig/mm/page_alloc.c 2006-06-18 15:20:12.000000000 +1000 |
34 | +++ linux-ck-dev/mm/page_alloc.c 2006-06-18 15:25:00.000000000 +1000 |
35 | @@ -1461,6 +1461,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 | @@ -1472,6 +1473,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->nr_active), |
49 | K(zone->nr_inactive), |
50 | K(zone->present_pages), |
51 | @@ -2261,6 +2263,7 @@ static int zoneinfo_show(struct seq_file |
52 | "\n min %lu" |
53 | "\n low %lu" |
54 | "\n high %lu" |
55 | + "\n lots %lu" |
56 | "\n active %lu" |
57 | "\n inactive %lu" |
58 | "\n scanned %lu (a: %lu i: %lu)" |
59 | @@ -2270,6 +2273,7 @@ static int zoneinfo_show(struct seq_file |
60 | zone->pages_min, |
61 | zone->pages_low, |
62 | zone->pages_high, |
63 | + zone->pages_lots, |
64 | zone->nr_active, |
65 | zone->nr_inactive, |
66 | zone->pages_scanned, |
67 | @@ -2609,6 +2613,7 @@ void setup_per_zone_pages_min(void) |
68 | |
69 | zone->pages_low = zone->pages_min + (tmp >> 2); |
70 | zone->pages_high = zone->pages_min + (tmp >> 1); |
71 | + zone->pages_lots = zone->pages_min + tmp; |
72 | spin_unlock_irqrestore(&zone->lru_lock, flags); |
73 | } |
74 | |
75 | Index: linux-ck-dev/mm/vmscan.c |
76 | =================================================================== |
77 | --- linux-ck-dev.orig/mm/vmscan.c 2006-06-18 15:24:58.000000000 +1000 |
78 | +++ linux-ck-dev/mm/vmscan.c 2006-06-18 15:25:00.000000000 +1000 |
79 | @@ -1095,6 +1095,7 @@ loop_again: |
80 | */ |
81 | for (i = pgdat->nr_zones - 1; i >= 0; i--) { |
82 | struct zone *zone = pgdat->node_zones + i; |
83 | + unsigned long watermark; |
84 | |
85 | if (!populated_zone(zone)) |
86 | continue; |
87 | @@ -1102,11 +1103,18 @@ loop_again: |
88 | if (zone->all_unreclaimable && priority != DEF_PRIORITY) |
89 | continue; |
90 | |
91 | - if (!zone_watermark_ok(zone, order, zone->pages_high, |
92 | - 0, 0)) { |
93 | + /* |
94 | + * The watermark is relaxed depending on the |
95 | + * level of "priority" till it drops to |
96 | + * pages_high. |
97 | + */ |
98 | + watermark = zone->pages_high + (zone->pages_high * |
99 | + priority / DEF_PRIORITY); |
100 | + if (!zone_watermark_ok(zone, order, watermark, 0, 0)) { |
101 | end_zone = i; |
102 | goto scan; |
103 | } |
104 | + |
105 | } |
106 | goto out; |
107 | scan: |
108 | @@ -1128,6 +1136,7 @@ scan: |
109 | for (i = 0; i <= end_zone; i++) { |
110 | struct zone *zone = pgdat->node_zones + i; |
111 | int nr_slab; |
112 | + unsigned long watermark; |
113 | |
114 | if (!populated_zone(zone)) |
115 | continue; |
116 | @@ -1135,7 +1144,10 @@ scan: |
117 | if (zone->all_unreclaimable && priority != DEF_PRIORITY) |
118 | continue; |
119 | |
120 | - if (!zone_watermark_ok(zone, order, zone->pages_high, |
121 | + watermark = zone->pages_high + (zone->pages_high * |
122 | + priority / DEF_PRIORITY); |
123 | + |
124 | + if (!zone_watermark_ok(zone, order, watermark, |
125 | end_zone, 0)) |
126 | all_zones_ok = 0; |
127 | zone->temp_priority = priority; |