Commit 0798e519 authored by Paul Jackson's avatar Paul Jackson Committed by Linus Torvalds

[PATCH] memory page alloc minor cleanups

- s/freeliest/freelist/ spelling fix

- Check for NULL *z zone seems useless - even if it could happen, so
  what?  Perhaps we should have a check later on if we are faced with an
  allocation request that is not allowed to fail - shouldn't that be a
  serious kernel error, passing an empty zonelist with a mandate to not
  fail?

- Initializing 'z' to zonelist->zones can wait until after the first
  get_page_from_freelist() fails; we only use 'z' in the wakeup_kswapd()
  loop, so let's initialize 'z' there, in a 'for' loop.  Seems clearer.

- Remove superfluous braces around a break

- Fix a couple errant spaces

- Adjust indentation on the cpuset_zone_allowed() check, to match the
  lines just before it -- seems easier to read in this case.

- Add another set of braces to the zone_watermark_ok logic

From: Paul Jackson <pj@sgi.com>

  Backout one item from a previous "memory page_alloc minor cleanups" patch.
   Until and unless we are certain that no one can ever pass an empty zonelist
  to __alloc_pages(), this check for an empty zonelist (or some BUG
  equivalent) is essential.  The code in get_page_from_freelist() blow ups if
  passed an empty zonelist.
Signed-off-by: default avatarPaul Jackson <pj@sgi.com>
Acked-by: default avatarChristoph Lameter <clameter@sgi.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarPaul Jackson <pj@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a2ce7740
...@@ -486,7 +486,7 @@ static void free_one_page(struct zone *zone, struct page *page, int order) ...@@ -486,7 +486,7 @@ static void free_one_page(struct zone *zone, struct page *page, int order)
spin_lock(&zone->lock); spin_lock(&zone->lock);
zone->all_unreclaimable = 0; zone->all_unreclaimable = 0;
zone->pages_scanned = 0; zone->pages_scanned = 0;
__free_one_page(page, zone ,order); __free_one_page(page, zone, order);
spin_unlock(&zone->lock); spin_unlock(&zone->lock);
} }
...@@ -926,7 +926,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, ...@@ -926,7 +926,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
} }
/* /*
* get_page_from_freeliest goes through the zonelist trying to allocate * get_page_from_freelist goes through the zonelist trying to allocate
* a page. * a page.
*/ */
static struct page * static struct page *
...@@ -959,17 +959,18 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, ...@@ -959,17 +959,18 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order,
mark = zone->pages_low; mark = zone->pages_low;
else else
mark = zone->pages_high; mark = zone->pages_high;
if (!zone_watermark_ok(zone , order, mark, if (!zone_watermark_ok(zone, order, mark,
classzone_idx, alloc_flags)) classzone_idx, alloc_flags)) {
if (!zone_reclaim_mode || if (!zone_reclaim_mode ||
!zone_reclaim(zone, gfp_mask, order)) !zone_reclaim(zone, gfp_mask, order))
continue; continue;
} }
}
page = buffered_rmqueue(zonelist, zone, order, gfp_mask); page = buffered_rmqueue(zonelist, zone, order, gfp_mask);
if (page) { if (page)
break; break;
}
} while (*(++z) != NULL); } while (*(++z) != NULL);
return page; return page;
} }
...@@ -1005,9 +1006,8 @@ restart: ...@@ -1005,9 +1006,8 @@ restart:
if (page) if (page)
goto got_pg; goto got_pg;
do { for (z = zonelist->zones; *z; z++)
wakeup_kswapd(*z, order); wakeup_kswapd(*z, order);
} while (*(++z));
/* /*
* OK, we're below the kswapd watermark and have kicked background * OK, we're below the kswapd watermark and have kicked background
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment