Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951Ab2FKAXg (ORCPT ); Sun, 10 Jun 2012 20:23:36 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:37772 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751110Ab2FKAXf (ORCPT ); Sun, 10 Jun 2012 20:23:35 -0400 Date: Mon, 11 Jun 2012 08:23:26 +0800 From: Wanpeng Li To: Minchan Kim Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Minchan Kim , Andrea Arcangeli , MelGorman , Michal Hocko , KAMEZAWA Hiroyuki Subject: Re: [PATCH] mm: do not use page_count without a page pin Message-ID: <20120611002325.GA2384@kernel> Reply-To: Wanpeng Li References: <1339373872-31969-1-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1339373872-31969-1-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1865 Lines: 53 On Mon, Jun 11, 2012 at 09:17:51AM +0900, Minchan Kim wrote: >d179e84ba fixed the problem[1] in vmscan.c but same problem is here. >Let's fix it. > >[1] http://comments.gmane.org/gmane.linux.kernel.mm/65844 > >I copy and paste d179e84ba's contents for description. > >"It is unsafe to run page_count during the physical pfn scan because >compound_head could trip on a dangling pointer when reading >page->first_page if the compound page is being freed by another CPU." > >Cc: Andrea Arcangeli >Cc: Mel Gorman >Cc: Michal Hocko >Cc: KAMEZAWA Hiroyuki >Signed-off-by: Minchan Kim >--- > mm/page_alloc.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/mm/page_alloc.c b/mm/page_alloc.c >index 266f267..019c4fe 100644 >--- a/mm/page_alloc.c >+++ b/mm/page_alloc.c >@@ -5496,7 +5496,11 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count) > continue; > > page = pfn_to_page(check); >- if (!page_count(page)) { >+ /* >+ * We can't use page_count withou pin a page ^ without >+ * because another CPU can free compound page. >+ */ >+ if (!atomic_read(&page->_count)) { > if (PageBuddy(page)) > iter += (1 << page_order(page)) - 1; > continue; >-- >1.7.9.5 > >-- >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: email@kvack.org -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/