linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: clear pages_scanned only if draining a pcp adds pages to the buddy allocator again
@ 2012-06-14 16:16 kosaki.motohiro
  2012-06-14 17:46 ` Rik van Riel
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: kosaki.motohiro @ 2012-06-14 16:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, akpm, KOSAKI Motohiro, David Rientjes, Mel Gorman,
	Johannes Weiner, Minchan Kim, Wu Fengguang, KAMEZAWA Hiroyuki,
	Rik van Riel

From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

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.

Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 mm/page_alloc.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5716b00..4e7059d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1157,8 +1157,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
@@ -3914,7 +3916,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);
 	}
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-06-22 21:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 16:16 [PATCH] mm: clear pages_scanned only if draining a pcp adds pages to the buddy allocator again kosaki.motohiro
2012-06-14 17:46 ` Rik van Riel
2012-06-15  7:19 ` Minchan Kim
2012-06-15 15:52   ` KOSAKI Motohiro
2012-06-15 23:21     ` Minchan Kim
2012-06-15  9:24 ` Mel Gorman
2012-06-15 16:19 ` Johannes Weiner
2012-06-16  6:55 ` Kamezawa Hiroyuki
2012-06-17  2:05 ` David Rientjes
2012-06-22 20:19 ` Andrew Morton
2012-06-22 21:10   ` KOSAKI Motohiro
2012-06-22 21:39     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).