Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.20-r6/0017-2.6.20-mm-lots_watermark.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1175 - (show annotations) (download)
Thu Oct 14 12:15:46 2010 UTC (13 years, 6 months ago) by niro
File size: 4042 byte(s)
-2.6.20-alx-r6 new magellan 0.5.2 kernel
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 | 3 +++
15 mm/vmscan.c | 17 ++++++++++++++---
16 3 files changed, 18 insertions(+), 4 deletions(-)
17
18 Index: linux-2.6.20-ck1/include/linux/mmzone.h
19 ===================================================================
20 --- linux-2.6.20-ck1.orig/include/linux/mmzone.h 2007-02-05 22:52:04.000000000 +1100
21 +++ linux-2.6.20-ck1/include/linux/mmzone.h 2007-02-16 19:01:33.000000000 +1100
22 @@ -156,7 +156,7 @@ enum zone_type {
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-2.6.20-ck1/mm/page_alloc.c
32 ===================================================================
33 --- linux-2.6.20-ck1.orig/mm/page_alloc.c 2007-02-05 22:52:04.000000000 +1100
34 +++ linux-2.6.20-ck1/mm/page_alloc.c 2007-02-16 19:01:33.000000000 +1100
35 @@ -1604,6 +1604,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 @@ -1615,6 +1616,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 @@ -3149,6 +3151,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.20-ck1/mm/vmscan.c
60 ===================================================================
61 --- linux-2.6.20-ck1.orig/mm/vmscan.c 2007-02-16 19:01:33.000000000 +1100
62 +++ linux-2.6.20-ck1/mm/vmscan.c 2007-02-16 19:01:33.000000000 +1100
63 @@ -1172,6 +1172,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 @@ -1179,8 +1180,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 @@ -1206,6 +1213,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 @@ -1213,7 +1221,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;