Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753456AbbG3OH1 (ORCPT ); Thu, 30 Jul 2015 10:07:27 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:37760 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542AbbG3OHX convert rfc822-to-8bit (ORCPT ); Thu, 30 Jul 2015 10:07:23 -0400 From: Michal Nazarewicz To: Vlastimil Babka , Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, "minkyung88.kim" , kmk3210@gmail.com, Seungho Park , Vlastimil Babka , Joonsoo Kim , Minchan Kim , Laura Abbott , Naoya Horiguchi , Johannes Weiner , "Kirill A. Shutemov" , Mel Gorman Subject: Re: [PATCH 1/2] mm, page_isolation: remove bogus tests for isolated pages In-Reply-To: <1437483218-18703-1-git-send-email-vbabka@suse.cz> Organization: http://mina86.com/ References: <55969822.9060907@suse.cz> <1437483218-18703-1-git-send-email-vbabka@suse.cz> User-Agent: Notmuch/0.19+53~g2e63a09 (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu) X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd;KFrfMCylc}gc??'U2j,!8%xdD Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:150730:minchan@kernel.org::qwu8J2NFk25jjzim:000000000000000000000000000000000000000000000cq X-Hashcash: 1:20:150730:minkyung88.kim@lge.com::4r0TvWEaRCyZcSs+:0000000000000000000000000000000000000000iak X-Hashcash: 1:20:150730:akpm@linux-foundation.org::UgFvCNhKlx/KHA/X:0000000000000000000000000000000000000NVQ X-Hashcash: 1:20:150730:kmk3210@gmail.com::H1UJJ5VA2bwnno01:000000000000000000000000000000000000000000000ps0 X-Hashcash: 1:20:150730:vbabka@suse.cz::H+gKQcMj4vuGHJYe:0000wqh X-Hashcash: 1:20:150730:lauraa@codeaurora.org::zAii2o1cTKrTizlX:00000000000000000000000000000000000000001cNj X-Hashcash: 1:20:150730:kirill.shutemov@linux.intel.com::4/Lxe7tPnPrJ0P7F:0000000000000000000000000000002Fg1 X-Hashcash: 1:20:150730:linux-kernel@vger.kernel.org::A7ArMy8OV7DYPOmy:0000000000000000000000000000000002MyD X-Hashcash: 1:20:150730:mgorman@suse.de::x5sNTtLN8MX/TxO0:003lCz X-Hashcash: 1:20:150730:n-horiguchi@ah.jp.nec.com::IuiGgoGeCYelZ47U:00000000000000000000000000000000000028OI X-Hashcash: 1:20:150730:seungho1.park@lge.com::yruxD+mqVSGhD9Nl:00000000000000000000000000000000000000005MhP X-Hashcash: 1:20:150730:hannes@cmpxchg.org::y5fYbrU+eSbk0dqv:00000000000000000000000000000000000000000005HYv X-Hashcash: 1:20:150730:vbabka@suse.cz::1Y08VXe4I+VvC63F:0006Kcg X-Hashcash: 1:20:150730:linux-mm@kvack.org::+/AKn14T5Eam6tW3:000000000000000000000000000000000000000000087Bp X-Hashcash: 1:20:150730:iamjoonsoo.kim@lge.com::/I/V3fTcmv6eNGft:000000000000000000000000000000000000000DxtU Date: Thu, 30 Jul 2015 16:07:18 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4410 Lines: 101 On Tue, Jul 21 2015, Vlastimil Babka wrote: > The __test_page_isolated_in_pageblock() is used to verify whether all pages > in pageblock were either successfully isolated, or are hwpoisoned. Two of the > possible state of pages, that are tested, are however bogus and misleading. > > Both tests rely on get_freepage_migratetype(page), which however has no > guarantees about pages on freelists. Specifically, it doesn't guarantee that > the migratetype returned by the function actually matches the migratetype of > the freelist that the page is on. Such guarantee is not its purpose and would > have negative impact on allocator performance. > > The first test checks whether the freepage_migratetype equals MIGRATE_ISOLATE, > supposedly to catch races between page isolation and allocator activity. These > races should be fixed nowadays with 51bb1a4093 ("mm/page_alloc: add freepage > on isolate pageblock to correct buddy list") and related patches. As explained > above, the check wouldn't be able to catch them reliably anyway. For the same > reason false positives can happen, although they are harmless, as the > move_freepages() call would just move the page to the same freelist it's > already on. So removing the test is not a bug fix, just cleanup. After this > patch, we assume that all PageBuddy pages are on the correct freelist and that > the races were really fixed. A truly reliable verification in the form of e.g. > VM_BUG_ON() would be complicated and is arguably not needed. > > The second test (page_count(page) == 0 && get_freepage_migratetype(page) > == MIGRATE_ISOLATE) is probably supposed (the code comes from a big memory > isolation patch from 2007) to catch pages on MIGRATE_ISOLATE pcplists. > However, pcplists don't contain MIGRATE_ISOLATE freepages nowadays, those are > freed directly to free lists, so the check is obsolete. Remove it as well. > > Signed-off-by: Vlastimil Babka > Cc: Joonsoo Kim > Cc: Minchan Kim > Cc: Michal Nazarewicz Acked-by: Michal Nazarewicz > Cc: Laura Abbott > Cc: Naoya Horiguchi > --- > mm/page_isolation.c | 30 ++++++------------------------ > 1 file changed, 6 insertions(+), 24 deletions(-) > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index 0e69d25..9eaa489c 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -226,34 +226,16 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn, > continue; > } > page = pfn_to_page(pfn); > - if (PageBuddy(page)) { > + if (PageBuddy(page)) > /* > - * If race between isolatation and allocation happens, > - * some free pages could be in MIGRATE_MOVABLE list > - * although pageblock's migratation type of the page > - * is MIGRATE_ISOLATE. Catch it and move the page into > - * MIGRATE_ISOLATE list. > + * If the page is on a free list, it has to be on > + * the correct MIGRATE_ISOLATE freelist. There is no > + * simple way to verify that as VM_BUG_ON(), though. > */ > - if (get_freepage_migratetype(page) != MIGRATE_ISOLATE) { > - struct page *end_page; > - > - end_page = page + (1 << page_order(page)) - 1; > - move_freepages(page_zone(page), page, end_page, > - MIGRATE_ISOLATE); > - } > pfn += 1 << page_order(page); > - } > - else if (page_count(page) == 0 && > - get_freepage_migratetype(page) == MIGRATE_ISOLATE) > - pfn += 1; > - else if (skip_hwpoisoned_pages && PageHWPoison(page)) { > - /* > - * The HWPoisoned page may be not in buddy > - * system, and page_count() is not 0. > - */ > + else if (skip_hwpoisoned_pages && PageHWPoison(page)) > + /* A HWPoisoned page cannot be also PageBuddy */ > pfn++; > - continue; > - } > else > break; > } > -- > 2.4.5 > -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +------ooO--(_)--Ooo-- -- 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/