Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669AbbBMGkN (ORCPT ); Fri, 13 Feb 2015 01:40:13 -0500 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:49687 "EHLO lgemrelse6q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269AbbBMGkL (ORCPT ); Fri, 13 Feb 2015 01:40:11 -0500 X-Original-SENDERIP: 10.178.37.108 X-Original-MAILFROM: gioh.kim@lge.com Message-ID: <54DD9C48.90803@lge.com> Date: Fri, 13 Feb 2015 15:40:08 +0900 From: Gioh Kim User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Joonsoo Kim , Andrew Morton CC: Rik van Riel , Johannes Weiner , Mel Gorman , Laura Abbott , Minchan Kim , Heesub Shin , Marek Szyprowski , Michal Nazarewicz , "Aneesh Kumar K.V" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hui Zhu , Bartlomiej Zolnierkiewicz , Ritesh Harjani , Vlastimil Babka Subject: Re: [RFC 07/16] mm/page_isolation: watch out zone range overlap References: <1423726340-4084-1-git-send-email-iamjoonsoo.kim@lge.com> <1423726340-4084-8-git-send-email-iamjoonsoo.kim@lge.com> In-Reply-To: <1423726340-4084-8-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=euc-kr Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2367 Lines: 60 > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index c8778f7..883e78d 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -210,8 +210,8 @@ int undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, > * Returns 1 if all pages in the range are isolated. > */ > static int > -__test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn, > - bool skip_hwpoisoned_pages) > +__test_page_isolated_in_pageblock(struct zone *zone, unsigned long pfn, > + unsigned long end_pfn, bool skip_hwpoisoned_pages) > { > struct page *page; > > @@ -221,6 +221,9 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn, > continue; > } > page = pfn_to_page(pfn); > + if (page_zone(page) != zone) > + break; > + > if (PageBuddy(page)) { > /* > * If race between isolatation and allocation happens, > @@ -281,7 +284,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, > /* Check all pages are free or marked as ISOLATED */ > zone = page_zone(page); > spin_lock_irqsave(&zone->lock, flags); > - ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn, > + ret = __test_page_isolated_in_pageblock(zone, start_pfn, end_pfn, > skip_hwpoisoned_pages); > spin_unlock_irqrestore(&zone->lock, flags); > return ret ? 0 : -EBUSY; > What about checking zone at test_pages_isolated? It might be a little bit early and without locking zone. @@ -273,8 +273,14 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, * are not aligned to pageblock_nr_pages. * Then we just check migratetype first. */ + + zone = page_zone(__first_valid_page(start_pfn, pageblock_nr_pages)); + for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { page = __first_valid_page(pfn, pageblock_nr_pages); + + if (page_zone(page) != zone) + break; if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE) break; } -- 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/