From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB9A1C55ABD for ; Thu, 12 Nov 2020 11:25:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0FBCF2220B for ; Thu, 12 Nov 2020 11:25:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FBCF2220B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 817A26B0071; Thu, 12 Nov 2020 06:25:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C8A96B0072; Thu, 12 Nov 2020 06:25:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 706E46B0073; Thu, 12 Nov 2020 06:25:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 440186B0071 for ; Thu, 12 Nov 2020 06:25:30 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EA38E180AD801 for ; Thu, 12 Nov 2020 11:25:29 +0000 (UTC) X-FDA: 77475535578.26.group28_1302d9d27306 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id C65301804B65A for ; Thu, 12 Nov 2020 11:25:29 +0000 (UTC) X-HE-Tag: group28_1302d9d27306 X-Filterd-Recvd-Size: 3603 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 11:25:29 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 63172AF74; Thu, 12 Nov 2020 11:25:27 +0000 (UTC) Subject: Re: [PATCH v21 15/19] mm/compaction: do page isolation first in compaction To: Hugh Dickins Cc: Alex Shi , akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com References: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> <1604566549-62481-16-git-send-email-alex.shi@linux.alibaba.com> From: Vlastimil Babka Message-ID: <85a40d01-09b6-1647-4ca0-7a83efdd9cbf@suse.cz> Date: Thu, 12 Nov 2020 12:25:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/12/20 3:28 AM, Hugh Dickins wrote: > On Wed, 11 Nov 2020, Vlastimil Babka wrote: >> On 11/5/20 9:55 AM, Alex Shi wrote: >> >> > @@ -979,10 +995,6 @@ static bool too_many_isolated(pg_data_t *pgdat) >> > goto isolate_abort; >> > } >> > - /* Recheck PageLRU and PageCompound under lock */ >> > - if (!PageLRU(page)) >> > - goto isolate_fail; >> > - >> > /* >> > * Page become compound since the non-locked check, >> > * and it's on LRU. It can only be a THP so the order >> > @@ -990,16 +1002,13 @@ static bool too_many_isolated(pg_data_t *pgdat) > > Completely off-topic, and won't matter at all when Andrew rediffs into > mmotm: but isn't it weird that this is showing "too_many_isolated(", > when actually the function is isolate_migratepages_block()? > >> > */ >> > if (unlikely(PageCompound(page) && >> > !cc->alloc_contig)) { >> > low_pfn += compound_nr(page) - 1; >> > - goto isolate_fail; >> > + SetPageLRU(page); >> > + goto isolate_fail_put; >> > } >> >> IIUC the danger here is khugepaged will collapse a THP. For that, >> __collapse_huge_page_isolate() has to succeed isolate_lru_page(). Under the >> new scheme, it shouldn't be possible, right? If that's correct, we can remove >> this part? > > I don't think so. A preliminary check for PageCompound was made much > higher up, before taking a reference on the page, but it can easily have > become PageCompound since then (when racing prep_new_page() calls > prep_compound_page()). > > And __collapse_huge_page_isolate() does not turn a non-compound page > into a compound page: it isolates small pages before copying them into > the compound page (in the usual case: I can see there's also allowance > for PageCompound there too, which will do something different). Right, on both points, got too confused. > Hugh >