[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FDAE1F0.4030708@kernel.org>
Date: Fri, 15 Jun 2012 16:19:12 +0900
From: Minchan Kim <minchan@...nel.org>
To: kosaki.motohiro@...il.com
CC: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
David Rientjes <rientjes@...gle.com>,
Mel Gorman <mel@....ul.ie>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan.kim@...il.com>,
Wu Fengguang <fengguang.wu@...el.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] mm: clear pages_scanned only if draining a pcp adds pages
to the buddy allocator again
On 06/15/2012 01:16 AM, kosaki.motohiro@...il.com wrote:
> From: KOSAKI Motohiro <kosaki.motohiro@...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@...gle.com>
> Cc: Mel Gorman <mel@....ul.ie>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Minchan Kim <minchan.kim@...il.com>
> Cc: Wu Fengguang <fengguang.wu@...el.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Reviewed-by: Minchan Kim <minchan@...nel.org>
Just nitpick.
Personally, I want to fix it follwing as
It's more simple and reduce vulnerable error in future.
If you mind, go ahead with your version. I am not against with it, either.
barrios@...x:~/linux-next$ git diff
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4403009..a32ac56 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -637,6 +637,12 @@ static void free_pcppages_bulk(struct zone *zone, int count,
int batch_free = 0;
int to_free = count;
+ /*
+ * Let's avoid unnecessary reset of pages_scanned.
+ */
+ if (!count)
+ return;
+
spin_lock(&zone->lock);
zone->all_unreclaimable = 0;
zone->pages_scanned = 0;
@@ -1175,6 +1181,7 @@ static void drain_pages(unsigned int cpu)
{
unsigned long flags;
struct zone *zone;
+ int to_drain;
for_each_populated_zone(zone) {
struct per_cpu_pageset *pset;
@@ -1184,10 +1191,9 @@ static void drain_pages(unsigned int cpu)
pset = per_cpu_ptr(zone->pageset, cpu);
pcp = &pset->pcp;
- if (pcp->count) {
- free_pcppages_bulk(zone, pcp->count, pcp);
- pcp->count = 0;
- }
+ to_drain = pcp->count;
+ free_pcppages_bulk(zone, to_drain, pcp);
+ pcp->count -= to_drain;
local_irq_restore(flags);
}
}
--
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists