aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 25f39865e324..9c44b9a39d30 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -637,7 +637,8 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
637 */ 637 */
638void drain_node_pages(int nodeid) 638void drain_node_pages(int nodeid)
639{ 639{
640 int i, z; 640 int i;
641 enum zone_type z;
641 unsigned long flags; 642 unsigned long flags;
642 643
643 for (z = 0; z < MAX_NR_ZONES; z++) { 644 for (z = 0; z < MAX_NR_ZONES; z++) {
@@ -1158,7 +1159,8 @@ EXPORT_SYMBOL(nr_free_pages);
1158#ifdef CONFIG_NUMA 1159#ifdef CONFIG_NUMA
1159unsigned int nr_free_pages_pgdat(pg_data_t *pgdat) 1160unsigned int nr_free_pages_pgdat(pg_data_t *pgdat)
1160{ 1161{
1161 unsigned int i, sum = 0; 1162 unsigned int sum = 0;
1163 enum zone_type i;
1162 1164
1163 for (i = 0; i < MAX_NR_ZONES; i++) 1165 for (i = 0; i < MAX_NR_ZONES; i++)
1164 sum += pgdat->node_zones[i].free_pages; 1166 sum += pgdat->node_zones[i].free_pages;
@@ -1358,21 +1360,22 @@ void show_free_areas(void)
1358 * Add all populated zones of a node to the zonelist. 1360 * Add all populated zones of a node to the zonelist.
1359 */ 1361 */
1360static int __meminit build_zonelists_node(pg_data_t *pgdat, 1362static int __meminit build_zonelists_node(pg_data_t *pgdat,
1361 struct zonelist *zonelist, int nr_zones, int zone_type) 1363 struct zonelist *zonelist, int nr_zones, enum zone_type zone_type)
1362{ 1364{
1363 struct zone *zone; 1365 struct zone *zone;
1364 1366
1365 BUG_ON(zone_type >= MAX_NR_ZONES); 1367 BUG_ON(zone_type >= MAX_NR_ZONES);
1368 zone_type++;
1366 1369
1367 do { 1370 do {
1371 zone_type--;
1368 zone = pgdat->node_zones + zone_type; 1372 zone = pgdat->node_zones + zone_type;
1369 if (populated_zone(zone)) { 1373 if (populated_zone(zone)) {
1370 zonelist->zones[nr_zones++] = zone; 1374 zonelist->zones[nr_zones++] = zone;
1371 check_highest_zone(zone_type); 1375 check_highest_zone(zone_type);
1372 } 1376 }
1373 zone_type--;
1374 1377
1375 } while (zone_type >= 0); 1378 } while (zone_type);
1376 return nr_zones; 1379 return nr_zones;
1377} 1380}
1378 1381
@@ -1441,10 +1444,11 @@ static int __meminit find_next_best_node(int node, nodemask_t *used_node_mask)
1441 1444
1442static void __meminit build_zonelists(pg_data_t *pgdat) 1445static void __meminit build_zonelists(pg_data_t *pgdat)
1443{ 1446{
1444 int i, j, k, node, local_node; 1447 int i, j, node, local_node;
1445 int prev_node, load; 1448 int prev_node, load;
1446 struct zonelist *zonelist; 1449 struct zonelist *zonelist;
1447 nodemask_t used_mask; 1450 nodemask_t used_mask;
1451 enum zone_type k;
1448 1452
1449 /* initialize zonelists */ 1453 /* initialize zonelists */
1450 for (i = 0; i < GFP_ZONETYPES; i++) { 1454 for (i = 0; i < GFP_ZONETYPES; i++) {
@@ -1628,7 +1632,7 @@ static void __init calculate_zone_totalpages(struct pglist_data *pgdat,
1628 unsigned long *zones_size, unsigned long *zholes_size) 1632 unsigned long *zones_size, unsigned long *zholes_size)
1629{ 1633{
1630 unsigned long realtotalpages, totalpages = 0; 1634 unsigned long realtotalpages, totalpages = 0;
1631 int i; 1635 enum zone_type i;
1632 1636
1633 for (i = 0; i < MAX_NR_ZONES; i++) 1637 for (i = 0; i < MAX_NR_ZONES; i++)
1634 totalpages += zones_size[i]; 1638 totalpages += zones_size[i];
@@ -2116,7 +2120,7 @@ static void calculate_totalreserve_pages(void)
2116{ 2120{
2117 struct pglist_data *pgdat; 2121 struct pglist_data *pgdat;
2118 unsigned long reserve_pages = 0; 2122 unsigned long reserve_pages = 0;
2119 int i, j; 2123 enum zone_type i, j;
2120 2124
2121 for_each_online_pgdat(pgdat) { 2125 for_each_online_pgdat(pgdat) {
2122 for (i = 0; i < MAX_NR_ZONES; i++) { 2126 for (i = 0; i < MAX_NR_ZONES; i++) {
@@ -2149,7 +2153,7 @@ static void calculate_totalreserve_pages(void)
2149static void setup_per_zone_lowmem_reserve(void) 2153static void setup_per_zone_lowmem_reserve(void)
2150{ 2154{
2151 struct pglist_data *pgdat; 2155 struct pglist_data *pgdat;
2152 int j, idx; 2156 enum zone_type j, idx;
2153 2157
2154 for_each_online_pgdat(pgdat) { 2158 for_each_online_pgdat(pgdat) {
2155 for (j = 0; j < MAX_NR_ZONES; j++) { 2159 for (j = 0; j < MAX_NR_ZONES; j++) {
@@ -2158,9 +2162,12 @@ static void setup_per_zone_lowmem_reserve(void)
2158 2162
2159 zone->lowmem_reserve[j] = 0; 2163 zone->lowmem_reserve[j] = 0;
2160 2164
2161 for (idx = j-1; idx >= 0; idx--) { 2165 idx = j;
2166 while (idx) {
2162 struct zone *lower_zone; 2167 struct zone *lower_zone;
2163 2168
2169 idx--;
2170
2164 if (sysctl_lowmem_reserve_ratio[idx] < 1) 2171 if (sysctl_lowmem_reserve_ratio[idx] < 1)
2165 sysctl_lowmem_reserve_ratio[idx] = 1; 2172 sysctl_lowmem_reserve_ratio[idx] = 1;
2166 2173