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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 64D1DC433E3 for ; Wed, 19 Aug 2020 14:48:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 15BD920866 for ; Wed, 19 Aug 2020 14:48:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YYBHKawx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15BD920866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 86CD38D0003; Wed, 19 Aug 2020 10:48:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F7B96B00BA; Wed, 19 Aug 2020 10:48:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 696AB8D0003; Wed, 19 Aug 2020 10:48:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id 5042E6B00B8 for ; Wed, 19 Aug 2020 10:48:24 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D1B53180AD806 for ; Wed, 19 Aug 2020 14:48:23 +0000 (UTC) X-FDA: 77167598886.27.feet24_580857727028 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 167D63D674 for ; Wed, 19 Aug 2020 14:48:23 +0000 (UTC) X-HE-Tag: feet24_580857727028 X-Filterd-Recvd-Size: 5520 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Aug 2020 14:48:22 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id q14so17420590ilm.2 for ; Wed, 19 Aug 2020 07:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0ApYOFSEYaJPt7kKwt38Kbe/M+l0V8+5a0AJxr5VRnc=; b=YYBHKawxqJQGH1DRcGNuNEl8HkABjzipt0mrQB7bCYB3X3HNFEjzrPeNzEydAioj/M DwVxkFmLmp6FYn7jLmVK819EibJcsnNXjaOcxdInSWq5tAKv62k7M0o5y4ysoqaF9BbV qphZCSByCz4tOwQ4m2IseIey1XrnftJYJn2p69QJBLHQc90jrKFj64a/XXMvuhpfRyGN XnKEk/0OPRCvmjVHuYH4zNer7uEKRmiXBGN9njK4kUWx3qyz6boBD4UioL22mwzjEwjt Oc5zDVyYkwMsJcnXux9zkSu9cM4OZg8KGChwRNkRqzHHlIxPITRBvJwd6qI/aGIExjjG jqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0ApYOFSEYaJPt7kKwt38Kbe/M+l0V8+5a0AJxr5VRnc=; b=Z5nJCCfPISwOASmVWP7mIPA5+LoEM6ZRyvNx3HOyAbqMlQlir6Gxcq+pNbjRPC8b9t RwbIf+oJb8lFH/Tor8bvw2eqHlIIDOd6BVPW6+S7QCoMa3NKuvN3cWNM6UBaoDVF5v3B mcjiLlAqrTb/fMd7z9LBymQdNFFZ0wYO03N7RrLDRAzeXBhhq1o/B8yivB7p1I7cEbAE KOxKVwsocDCqRT0UtpHb7aCdLfSD6xKMnAf9xYfybHxlczPaJT2K6DuL9E6HpYK/xVAA n67gEbUAOMdu8cLryDFj8wiHA+tj9vFfQypMlE4v9lyb5fRbj8bnJGad60UXPXXX1X7h w56Q== X-Gm-Message-State: AOAM531UkngYvZmIaRBwRZo3PeY/z2iaE8GY2jZVoAxFPQ3dCah3M2ow hr7WEMhkhwYqrTMjE2KcoZzTCasaWZqocJkxO8k= X-Google-Smtp-Source: ABdhPJzmEU0mpAvFX3yBtvh1+ob71cBaFPK3Zp+QxW5r94JaD4ZkLNuqIBncSh6+TTlYFpt1mGrwR4sv+irPX8Uoajs= X-Received: by 2002:a92:ae06:: with SMTP id s6mr21501169ilh.64.1597848501986; Wed, 19 Aug 2020 07:48:21 -0700 (PDT) MIME-Version: 1.0 References: <20200819041852.23414.95939.stgit@localhost.localdomain> <20200819042705.23414.84098.stgit@localhost.localdomain> <20200819114309.GB17456@casper.infradead.org> In-Reply-To: <20200819114309.GB17456@casper.infradead.org> From: Alexander Duyck Date: Wed, 19 Aug 2020 07:48:11 -0700 Message-ID: Subject: Re: [RFC PATCH v2 1/5] mm: Identify compound pages sooner in isolate_migratepages_block To: Matthew Wilcox Cc: Alex Shi , Yang Shi , kbuild test robot , Rong Chen , Konstantin Khlebnikov , "Kirill A. Shutemov" , Hugh Dickins , LKML , Daniel Jordan , linux-mm , Shakeel Butt , Johannes Weiner , Tejun Heo , cgroups@vger.kernel.org, Andrew Morton , Wei Yang , Mel Gorman , Joonsoo Kim Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 167D63D674 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 Wed, Aug 19, 2020 at 4:43 AM Matthew Wilcox wrote: > > On Tue, Aug 18, 2020 at 09:27:05PM -0700, Alexander Duyck wrote: > > + /* > > + * Page is compound. We know the order before we know if it is > > + * on the LRU so we cannot assume it is THP. However since the > > + * page will have the LRU validated shortly we can use the value > > + * to skip over this page for now or validate the LRU is set and > > + * then isolate the entire compound page if we are isolating to > > + * generate a CMA page. > > + */ > > + if (PageCompound(page)) { > > + const unsigned int order = compound_order(page); > > + > > + if (likely(order < MAX_ORDER)) > > + low_pfn += (1UL << order) - 1; > > Hmm. You're checking for PageCompound but then skipping 1UL << order. > That only works if PageHead. If instead this is PageCompound because > it's PageTail, you need to do something like: > > low_pfn |= (1UL << order) - 1; > > which will move you to the end of the page you're in the middle of. Can you successfully call get_page_unless_zero in a tail page? I thought their reference count was 0? There is a get_page_unless_zero call before the PageCompound check, so I don't think we can get a tail page. > If PageTail can't actually happen here, then it's better to check for > PageHead explicitly and WARN_ON if you get a PageTail (eg a page was > combined into a compound page after you processed the earlier head page). > > Is it possible the page you've found is hugetlbfs? Those can have orders > larger than MAX_ORDER. So in theory we only need to jump pageblock_order. However there are some architectures where that is not a fixed constant and so it would have some additional overhead if I am not mistaken. In addition we should have been only provided a pageblock if i am not mistaken so the check further down that prevents low_pfn from passing end_pfn should reset to the correct value.