Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.16-r10/0021-2.6.16-vm-lots_watermark.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (show annotations) (download)
Thu May 11 19:09:22 2006 UTC (18 years ago) by niro
File size: 4323 byte(s)
import

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 | 17 +++++++++++++++--
16 3 files changed, 21 insertions(+), 3 deletions(-)
17
18 Index: linux-2.6.16-ck1/include/linux/mmzone.h
19 ===================================================================
20 --- linux-2.6.16-ck1.orig/include/linux/mmzone.h 2006-03-20 20:46:24.000000000 +1100
21 +++ linux-2.6.16-ck1/include/linux/mmzone.h 2006-03-20 20:46:57.000000000 +1100
22 @@ -120,7 +120,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-2.6.16-ck1/mm/page_alloc.c
32 ===================================================================
33 --- linux-2.6.16-ck1.orig/mm/page_alloc.c 2006-03-20 20:46:24.000000000 +1100
34 +++ linux-2.6.16-ck1/mm/page_alloc.c 2006-03-20 20:46:57.000000000 +1100
35 @@ -1436,6 +1436,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 @@ -1447,6 +1448,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 @@ -2227,6 +2229,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 @@ -2236,6 +2239,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 @@ -2538,6 +2542,7 @@ void setup_per_zone_pages_min(void)
68
69 zone->pages_low = zone->pages_min + tmp / 4;
70 zone->pages_high = zone->pages_min + tmp / 2;
71 + zone->pages_lots = zone->pages_min + tmp;
72 spin_unlock_irqrestore(&zone->lru_lock, flags);
73 }
74 }
75 Index: linux-2.6.16-ck1/mm/vmscan.c
76 ===================================================================
77 --- linux-2.6.16-ck1.orig/mm/vmscan.c 2006-03-20 20:46:56.000000000 +1100
78 +++ linux-2.6.16-ck1/mm/vmscan.c 2006-03-20 20:46:57.000000000 +1100
79 @@ -1580,6 +1580,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 @@ -1588,8 +1589,17 @@ loop_again:
88 priority != DEF_PRIORITY)
89 continue;
90
91 + /*
92 + * The watermark is relaxed depending on the
93 + * level of "priority" till it drops to
94 + * pages_high.
95 + */
96 + watermark = zone->pages_high +
97 + (zone->pages_high * priority /
98 + DEF_PRIORITY);
99 +
100 if (!zone_watermark_ok(zone, order,
101 - zone->pages_high, 0, 0)) {
102 + watermark, 0, 0)) {
103 end_zone = i;
104 goto scan;
105 }
106 @@ -1625,8 +1635,11 @@ scan:
107 continue;
108
109 if (nr_pages == 0) { /* Not software suspend */
110 + unsigned long watermark = zone->pages_high +
111 + (zone->pages_high * priority /
112 + DEF_PRIORITY);
113 if (!zone_watermark_ok(zone, order,
114 - zone->pages_high, end_zone, 0))
115 + watermark, end_zone, 0))
116 all_zones_ok = 0;
117 }
118 zone->temp_priority = priority;