aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2012-07-31 19:42:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 21:42:42 -0400
commit2a13515c398bbe471bf64519ada87fd708152ced (patch)
tree6167884779ebd978b3889231fdeaf45d4178149a /mm/page_alloc.c
parent3d3727cdb07ff17ddc3c551ef8d03d37b60a0372 (diff)
mm: clear pages_scanned only if draining a pcp adds pages to the buddy allocator again
commit 2ff754fa8f ("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 <kosaki.motohiro@jp.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Minchan Kim <minchan@kernel.org> Cc: Wu Fengguang <fengguang.wu@intel.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 80ef99234b89..18747528eec3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1158,8 +1158,10 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp)
1158 to_drain = pcp->batch; 1158 to_drain = pcp->batch;
1159 else 1159 else
1160 to_drain = pcp->count; 1160 to_drain = pcp->count;
1161 free_pcppages_bulk(zone, to_drain, pcp); 1161 if (to_drain > 0) {
1162 pcp->count -= to_drain; 1162 free_pcppages_bulk(zone, to_drain, pcp);
1163 pcp->count -= to_drain;
1164 }
1163 local_irq_restore(flags); 1165 local_irq_restore(flags);
1164} 1166}
1165#endif 1167#endif
@@ -3915,7 +3917,8 @@ static int __zone_pcp_update(void *data)
3915 pcp = &pset->pcp; 3917 pcp = &pset->pcp;
3916 3918
3917 local_irq_save(flags); 3919 local_irq_save(flags);
3918 free_pcppages_bulk(zone, pcp->count, pcp); 3920 if (pcp->count > 0)
3921 free_pcppages_bulk(zone, pcp->count, pcp);
3919 setup_pageset(pset, batch); 3922 setup_pageset(pset, batch);
3920 local_irq_restore(flags); 3923 local_irq_restore(flags);
3921 } 3924 }