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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 3A694C433E3 for ; Wed, 19 Aug 2020 11:43:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7F5A206FA for ; Wed, 19 Aug 2020 11:43:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="RXOzKbrx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7F5A206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7A22A6B0095; Wed, 19 Aug 2020 07:43:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7517C6B0096; Wed, 19 Aug 2020 07:43:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68FD26B0098; Wed, 19 Aug 2020 07:43:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 547876B0095 for ; Wed, 19 Aug 2020 07:43:41 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0EBE2181AEF10 for ; Wed, 19 Aug 2020 11:43:41 +0000 (UTC) X-FDA: 77167133442.29.pot51_2209e1427027 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id CDD9518086CC2 for ; Wed, 19 Aug 2020 11:43:40 +0000 (UTC) X-HE-Tag: pot51_2209e1427027 X-Filterd-Recvd-Size: 3303 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Aug 2020 11:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ak4zJfL3jaSZH9A144fE0Ks6867bEAtu2NTkcDH4RvU=; b=RXOzKbrxZsfW3t1Wc6xtkyc7lT I+02t0IG7W47hbjx6qsg4QiL6EcBfdWn2aBpC7gmY52ux5erb1OYdpDwQu58mJ9ZG4hmTgVFgDIMb CKVgKq/EMapYfJeCEq7+sPv9fSjNFOr1z7bYFj6ovfyc3jt7+Gpy0dV/1c6OSRwXnmYUu9ayo7G9H acNNDxZjmcEBy/nqgab4XdpN5SnxJPNEca2H4ALpDZ/QhF6XGF/hKvoViSs2EYF4g1sUHQMErIgKf EqDgis9otkTiDaVkk0eQYqWc/Bxf9X8D3dXkNa/TV+XSz6A0hxRiY7AUM3ESI0ctl2xdYmsUfjk+Y R2hAdK3Q==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8MUn-0002W6-IT; Wed, 19 Aug 2020 11:43:09 +0000 Date: Wed, 19 Aug 2020 12:43:09 +0100 From: Matthew Wilcox To: Alexander Duyck Cc: alex.shi@linux.alibaba.com, yang.shi@linux.alibaba.com, lkp@intel.com, rong.a.chen@intel.com, khlebnikov@yandex-team.ru, kirill@shutemov.name, hughd@google.com, linux-kernel@vger.kernel.org, daniel.m.jordan@oracle.com, linux-mm@kvack.org, shakeelb@google.com, hannes@cmpxchg.org, tj@kernel.org, cgroups@vger.kernel.org, akpm@linux-foundation.org, richard.weiyang@gmail.com, mgorman@techsingularity.net, iamjoonsoo.kim@lge.com Subject: Re: [RFC PATCH v2 1/5] mm: Identify compound pages sooner in isolate_migratepages_block Message-ID: <20200819114309.GB17456@casper.infradead.org> References: <20200819041852.23414.95939.stgit@localhost.localdomain> <20200819042705.23414.84098.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819042705.23414.84098.stgit@localhost.localdomain> X-Rspamd-Queue-Id: CDD9518086CC2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 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. 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.