Skip to content

Commit

Permalink
[PATCH] VM: fix zone list restart in page allocatate
Browse files Browse the repository at this point in the history
We must reassign z before looping through the zones kicking kswapd,
since it will be NULL if we hit an OOM condition and jump back to the
beginning again. 'z' is initially assigned before the restart: label. So
move the restart label up a little.

Signed-off-by: Jens Axboe <axboe@suse.de>
  • Loading branch information
Jens Axboe authored and Linus Torvalds committed Nov 17, 2005
1 parent bb83398 commit 6b1de91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,21 +845,22 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order,

might_sleep_if(wait);

restart:
z = zonelist->zones; /* the list of zones suitable for gfp_mask */

if (unlikely(*z == NULL)) {
/* Should this ever happen?? */
return NULL;
}
restart:

page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order,
zonelist, ALLOC_CPUSET);
if (page)
goto got_pg;

do
do {
wakeup_kswapd(*z, order);
while (*(++z));
} while (*(++z));

/*
* OK, we're below the kswapd watermark and have kicked background
Expand Down

0 comments on commit 6b1de91

Please sign in to comment.