Annotation of /trunk/kernel26-magellan/patches-2.6.16-r12/0024-2.6.16-mm-prio_dependant_scan-1.patch
Parent Directory | Revision Log
Revision 72 -
(hide annotations)
(download)
Mon Jun 5 09:25:38 2006 UTC (18 years, 3 months ago) by niro
File size: 5682 byte(s)
Mon Jun 5 09:25:38 2006 UTC (18 years, 3 months ago) by niro
File size: 5682 byte(s)
ver bump to 2.6.16-r12: - updated to linux-2.6.16.19 - updated to ck11
1 | niro | 72 | fs/buffer.c | 2 +- |
2 | include/linux/swap.h | 2 +- | ||
3 | mm/page_alloc.c | 2 +- | ||
4 | mm/vmscan.c | 34 ++++++++++++++++++++-------------- | ||
5 | 4 files changed, 23 insertions(+), 17 deletions(-) | ||
6 | |||
7 | Index: linux-2.6.16-ck1/fs/buffer.c | ||
8 | =================================================================== | ||
9 | --- linux-2.6.16-ck1.orig/fs/buffer.c 2006-03-20 20:46:24.000000000 +1100 | ||
10 | +++ linux-2.6.16-ck1/fs/buffer.c 2006-03-20 20:46:59.000000000 +1100 | ||
11 | @@ -499,7 +499,7 @@ static void free_more_memory(void) | ||
12 | for_each_pgdat(pgdat) { | ||
13 | zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones; | ||
14 | if (*zones) | ||
15 | - try_to_free_pages(zones, GFP_NOFS); | ||
16 | + try_to_free_pages(zones, GFP_NOFS, NULL); | ||
17 | } | ||
18 | } | ||
19 | |||
20 | Index: linux-2.6.16-ck1/include/linux/swap.h | ||
21 | =================================================================== | ||
22 | --- linux-2.6.16-ck1.orig/include/linux/swap.h 2006-03-20 20:46:56.000000000 +1100 | ||
23 | +++ linux-2.6.16-ck1/include/linux/swap.h 2006-03-20 20:46:59.000000000 +1100 | ||
24 | @@ -173,7 +173,7 @@ extern int rotate_reclaimable_page(struc | ||
25 | extern void swap_setup(void); | ||
26 | |||
27 | /* linux/mm/vmscan.c */ | ||
28 | -extern int try_to_free_pages(struct zone **, gfp_t); | ||
29 | +extern int try_to_free_pages(struct zone **, gfp_t, struct task_struct *p); | ||
30 | extern int shrink_all_memory(int); | ||
31 | extern int vm_mapped; | ||
32 | extern int vm_hardmaplimit; | ||
33 | Index: linux-2.6.16-ck1/mm/page_alloc.c | ||
34 | =================================================================== | ||
35 | --- linux-2.6.16-ck1.orig/mm/page_alloc.c 2006-03-20 20:46:58.000000000 +1100 | ||
36 | +++ linux-2.6.16-ck1/mm/page_alloc.c 2006-03-20 20:46:59.000000000 +1100 | ||
37 | @@ -990,7 +990,7 @@ rebalance: | ||
38 | reclaim_state.reclaimed_slab = 0; | ||
39 | p->reclaim_state = &reclaim_state; | ||
40 | |||
41 | - did_some_progress = try_to_free_pages(zonelist->zones, gfp_mask); | ||
42 | + did_some_progress = try_to_free_pages(zonelist->zones, gfp_mask, p); | ||
43 | |||
44 | p->reclaim_state = NULL; | ||
45 | p->flags &= ~PF_MEMALLOC; | ||
46 | Index: linux-2.6.16-ck1/mm/vmscan.c | ||
47 | =================================================================== | ||
48 | --- linux-2.6.16-ck1.orig/mm/vmscan.c 2006-03-20 20:46:58.000000000 +1100 | ||
49 | +++ linux-2.6.16-ck1/mm/vmscan.c 2006-03-20 20:46:59.000000000 +1100 | ||
50 | @@ -1468,7 +1468,8 @@ shrink_caches(struct zone **zones, struc | ||
51 | * holds filesystem locks which prevent writeout this might not work, and the | ||
52 | * allocation attempt will fail. | ||
53 | */ | ||
54 | -int try_to_free_pages(struct zone **zones, gfp_t gfp_mask) | ||
55 | +int try_to_free_pages(struct zone **zones, gfp_t gfp_mask, | ||
56 | + struct task_struct *p ) | ||
57 | { | ||
58 | int priority; | ||
59 | int ret = 0; | ||
60 | @@ -1476,7 +1477,10 @@ int try_to_free_pages(struct zone **zone | ||
61 | struct reclaim_state *reclaim_state = current->reclaim_state; | ||
62 | struct scan_control sc; | ||
63 | unsigned long lru_pages = 0; | ||
64 | - int i; | ||
65 | + int i, scan_priority = DEF_PRIORITY; | ||
66 | + | ||
67 | + if (p) | ||
68 | + scan_priority = sc_priority(p); | ||
69 | |||
70 | sc.gfp_mask = gfp_mask; | ||
71 | sc.may_writepage = !laptop_mode; | ||
72 | @@ -1492,11 +1496,11 @@ int try_to_free_pages(struct zone **zone | ||
73 | if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) | ||
74 | continue; | ||
75 | |||
76 | - zone->temp_priority = DEF_PRIORITY; | ||
77 | + zone->temp_priority = scan_priority; | ||
78 | lru_pages += zone->nr_active + zone->nr_inactive; | ||
79 | } | ||
80 | |||
81 | - for (priority = DEF_PRIORITY; priority >= 0; priority--) { | ||
82 | + for (priority = scan_priority; priority >= 0; priority--) { | ||
83 | sc.nr_mapped = read_page_state(nr_mapped); | ||
84 | sc.nr_scanned = 0; | ||
85 | sc.nr_reclaimed = 0; | ||
86 | @@ -1530,7 +1534,7 @@ int try_to_free_pages(struct zone **zone | ||
87 | } | ||
88 | |||
89 | /* Take a nap, wait for some writeback to complete */ | ||
90 | - if (sc.nr_scanned && priority < DEF_PRIORITY - 2) | ||
91 | + if (sc.nr_scanned && priority < scan_priority - 2) | ||
92 | blk_congestion_wait(WRITE, HZ/10); | ||
93 | } | ||
94 | out: | ||
95 | @@ -1573,13 +1577,15 @@ out: | ||
96 | static int balance_pgdat(pg_data_t *pgdat, int nr_pages, int order) | ||
97 | { | ||
98 | int to_free = nr_pages; | ||
99 | - int all_zones_ok; | ||
100 | + int all_zones_ok = 0; | ||
101 | int priority; | ||
102 | - int i; | ||
103 | + int i, scan_priority; | ||
104 | int total_scanned, total_reclaimed; | ||
105 | struct reclaim_state *reclaim_state = current->reclaim_state; | ||
106 | struct scan_control sc; | ||
107 | |||
108 | + scan_priority = sc_priority(pgdat->kswapd); | ||
109 | + | ||
110 | loop_again: | ||
111 | total_scanned = 0; | ||
112 | total_reclaimed = 0; | ||
113 | @@ -1593,10 +1599,10 @@ loop_again: | ||
114 | for (i = 0; i < pgdat->nr_zones; i++) { | ||
115 | struct zone *zone = pgdat->node_zones + i; | ||
116 | |||
117 | - zone->temp_priority = DEF_PRIORITY; | ||
118 | + zone->temp_priority = scan_priority; | ||
119 | } | ||
120 | |||
121 | - for (priority = DEF_PRIORITY; priority >= 0; priority--) { | ||
122 | + for (priority = scan_priority; priority >= 0; priority--) { | ||
123 | int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ | ||
124 | unsigned long lru_pages = 0; | ||
125 | |||
126 | @@ -1619,7 +1625,7 @@ loop_again: | ||
127 | continue; | ||
128 | |||
129 | if (zone->all_unreclaimable && | ||
130 | - priority != DEF_PRIORITY) | ||
131 | + priority != scan_priority) | ||
132 | continue; | ||
133 | |||
134 | /* | ||
135 | @@ -1629,7 +1635,7 @@ loop_again: | ||
136 | */ | ||
137 | watermark = zone->pages_high + | ||
138 | (zone->pages_high * priority / | ||
139 | - DEF_PRIORITY); | ||
140 | + scan_priority); | ||
141 | |||
142 | if (!zone_watermark_ok(zone, order, | ||
143 | watermark, 0, 0)) { | ||
144 | @@ -1664,13 +1670,13 @@ scan: | ||
145 | if (!populated_zone(zone)) | ||
146 | continue; | ||
147 | |||
148 | - if (zone->all_unreclaimable && priority != DEF_PRIORITY) | ||
149 | + if (zone->all_unreclaimable && priority != scan_priority) | ||
150 | continue; | ||
151 | |||
152 | if (nr_pages == 0) { /* Not software suspend */ | ||
153 | unsigned long watermark = zone->pages_high + | ||
154 | (zone->pages_high * priority / | ||
155 | - DEF_PRIORITY); | ||
156 | + scan_priority); | ||
157 | if (!zone_watermark_ok(zone, order, | ||
158 | watermark, end_zone, 0)) | ||
159 | all_zones_ok = 0; | ||
160 | @@ -1711,7 +1717,7 @@ scan: | ||
161 | * OK, kswapd is getting into trouble. Take a nap, then take | ||
162 | * another pass across the zones. | ||
163 | */ | ||
164 | - if (total_scanned && priority < DEF_PRIORITY - 2) | ||
165 | + if (total_scanned && priority < scan_priority - 2) | ||
166 | blk_congestion_wait(WRITE, HZ/10); | ||
167 | |||
168 | /* |