Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp520878pxa; Wed, 19 Aug 2020 07:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvTagumgzedM/ths869WtDSHIWTGV2o/WU0XajgV79lZs4N3nw8F29a+MHQJuXnaolIvdQ X-Received: by 2002:a50:9fe6:: with SMTP id c93mr24057945edf.286.1597848633556; Wed, 19 Aug 2020 07:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597848633; cv=none; d=google.com; s=arc-20160816; b=Mv2mlJfOXnhlGfWLWgelo5lABQcactHmhZLSQGWTIZAhfm36Hc3o4y0IsptTBZyXi+ 0Tw/+sBYEqs/ojlOjHaCrdLIccu+x6qGchiOmyKJxSYu7tyi6wQR9oaWYK2HIyIFloLP OYNJRB5waDB8ego5s+IN/cROjT7aMY22Fgtv/DcC5/qS9vc250Hd60XVZADV869mDTDf akznmnXp6ppm+579DWCF+xNKE68B/ineM/tu6man0RZJXXawQXueJvSKbAdPL7pVYCep yTkIt9oWPVPYuKI5SKkur5/OzgpE+V+GzLlJ4NdRpzWJBVyAWDGvanXhKeDlVQaNV+qo UyRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0ApYOFSEYaJPt7kKwt38Kbe/M+l0V8+5a0AJxr5VRnc=; b=XrzyQigS1xRbViWEw3JRS3xRfO6oFLL9UDwfj95sp/dhDZDuh06OGvydCIBc/0ZuuO hXT/YuM90ZLitKFPOl3pZ0ZaXd57M3MZj2YuE63Utxmtb/3aZ47pOHjtTA0fnRG5FYjD na5uFLP1v3+psaUHRDM4+MoW4Yo4gVrpQrbtvZ2R3fca5kOjaR/ZPGJMhQhtxYYAW6Jp rwQ5o2NWj7V1Lo+vt33AIURN9CoGxVNI817kOgGIDMmS3hriEijaC7uXPo4TCFgtqYCf FgQILiFlxq3gWZLdXFbaESUTIzPCw/lvV1cY14BUvouMmdxgdRXdvvnsWKMlM7bRO2u2 Tw1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YYBHKawx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si15492010ejm.274.2020.08.19.07.50.07; Wed, 19 Aug 2020 07:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YYBHKawx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbgHSOsc (ORCPT + 99 others); Wed, 19 Aug 2020 10:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbgHSOs0 (ORCPT ); Wed, 19 Aug 2020 10:48:26 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5330C061757; Wed, 19 Aug 2020 07:48:22 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id t4so20870525iln.1; 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=bFyWn4V9J9q6ymkUsc5rdSN3qZO3xWAEWKScp1/3NQ8lxMyD56G86p9bgkY//jBLpa 5Km+NIZgSEti0BnTHKtvMW2h+OLzDIWVxzVl6Fi/uKf/7dNX+aHSch7++TCgB0mWsEx1 pIBLIBDstOD0llXsXuIfkVFx982t1mQxOlfE+vHK8LX37/aNou/dpz1qwb4PaaCnDquS mSpLAnqbPgcPKWfW3dcWHOqoREjkCVv2/C0KlyjYki9Qfu96UGg85KsVBzV2oMovmjeV 6kkbKBvgcGxeLOq4/asybxLQx9kArgrxU1pLTJBMbvvgQBpAuMnj3VYNec/s3+pyHNtz ikTw== X-Gm-Message-State: AOAM530/3zxrku/Z+j+ITjsAR55KirUruJHlEXzNXPoNjXNFr2m+K3+j wNr++OH/kcm098lCQcQP6c97BHTdgaq8JgVxpJf0q+uArbI= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.