Skip to content

Commit

Permalink
mm: clear pages_scanned only if draining a pcp adds pages to the budd…
Browse files Browse the repository at this point in the history
…y allocator again

commit 2ff754f ("mm: clear pages_scanned only if draining a pcp adds
pages to the buddy allocator again") fixed one free_pcppages_bulk()
misuse.  But two another miuse still exist.

This patch fixes it.

Signed-off-by: KOSAKI Motohiro <[email protected]>
Acked-by: David Rientjes <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Reviewed-by: Minchan Kim <[email protected]>
Cc: Wu Fengguang <[email protected]>
Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kosaki authored and torvalds committed Aug 1, 2012
1 parent 3d3727c commit 2a13515
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,10 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp)
to_drain = pcp->batch;
else
to_drain = pcp->count;
free_pcppages_bulk(zone, to_drain, pcp);
pcp->count -= to_drain;
if (to_drain > 0) {
free_pcppages_bulk(zone, to_drain, pcp);
pcp->count -= to_drain;
}
local_irq_restore(flags);
}
#endif
Expand Down Expand Up @@ -3915,7 +3917,8 @@ static int __zone_pcp_update(void *data)
pcp = &pset->pcp;

local_irq_save(flags);
free_pcppages_bulk(zone, pcp->count, pcp);
if (pcp->count > 0)
free_pcppages_bulk(zone, pcp->count, pcp);
setup_pageset(pset, batch);
local_irq_restore(flags);
}
Expand Down

0 comments on commit 2a13515

Please sign in to comment.