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 6ACF6C4361B for ; Wed, 9 Dec 2020 06:34:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 06BF523358 for ; Wed, 9 Dec 2020 06:34:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06BF523358 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 4A31E8D0007; Wed, 9 Dec 2020 01:34:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 454AB8D0002; Wed, 9 Dec 2020 01:34:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3425A8D0007; Wed, 9 Dec 2020 01:34:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 1F2A58D0002 for ; Wed, 9 Dec 2020 01:34:08 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C8FD81EE6 for ; Wed, 9 Dec 2020 06:34:07 +0000 (UTC) X-FDA: 77572778934.10.color32_440f014273ed Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id A3B1316A0DE for ; Wed, 9 Dec 2020 06:34:07 +0000 (UTC) X-HE-Tag: color32_440f014273ed X-Filterd-Recvd-Size: 4257 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 06:34:07 +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=+CpRBRSCNa0eicUgRiha4jJ2Xs6QCN3aamgew32OI0A=; b=Vny5zMI3uLth9IyKowG/frEUBr Y0KpowoLqfAO8EGLmna1WvkVLwyEZehA/IjWDslQ2YZNaxCgMD4+OawdkO9Ie1bOXEcaB0G07NAWB XOu6OF8v+LHOlzkkLxB+o7EGuV60XTyqOaK4Le2azuuNivmj7E6WNRX7cwQ5UzyCDBLrKSGB6oq6r 8iGcm1RnUA+VOoSnvS4ZDgzToUvBlcAceDLjSZMDcaRKly7Wvk9Az4cj+u46Uj6aw3eIp7cc8MSee doJVPvU5aqt1NxIvCdydn0Bz9Tmcmrhw+JoaLFmxSe9UXVd+sn+aWd62y75UyHutlkMKBCkd+aLsm leoSHe3g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmt2s-0006QH-Ns; Wed, 09 Dec 2020 06:33:50 +0000 Date: Wed, 9 Dec 2020 06:33:50 +0000 From: Matthew Wilcox To: John Hubbard Cc: Joao Martins , linux-mm@kvack.org, Dan Williams , Ira Weiny , linux-nvdimm@lists.01.org, Jason Gunthorpe , Jane Chu , Muchun Song , Mike Kravetz , Andrew Morton Subject: Re: [PATCH RFC 1/9] memremap: add ZONE_DEVICE support for compound pages Message-ID: <20201209063350.GO7338@casper.infradead.org> References: <20201208172901.17384-1-joao.m.martins@oracle.com> <20201208172901.17384-2-joao.m.martins@oracle.com> <7249cfd2-c178-2e6a-6b03-307a05f11785@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7249cfd2-c178-2e6a-6b03-307a05f11785@nvidia.com> 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, Dec 08, 2020 at 09:59:19PM -0800, John Hubbard wrote: > On 12/8/20 9:28 AM, Joao Martins wrote: > > Add a new flag for struct dev_pagemap which designates that a a pagemap > > a a > > > is described as a set of compound pages or in other words, that how > > pages are grouped together in the page tables are reflected in how we > > describe struct pages. This means that rather than initializing > > individual struct pages, we also initialize these struct pages, as > > Let's not say "rather than x, we also do y", because it's self-contradictory. > I think you want to just leave out the "also", like this: > > "This means that rather than initializing> individual struct pages, we > initialize these struct pages ..." > > Is that right? I'd phrase it as: Add a new flag for struct dev_pagemap which specifies that a pagemap is composed of a set of compound pages instead of individual pages. When these pages are initialised, most are initialised as tail pages instead of order-0 pages. > > For certain ZONE_DEVICE users, like device-dax, which have a fixed page > > size, this creates an opportunity to optimize GUP and GUP-fast walkers, > > thus playing the same tricks as hugetlb pages. Rather than "playing the same tricks", how about "are treated the same way as THP or hugetlb pages"? > > + if (pgmap->flags & PGMAP_COMPOUND) > > + percpu_ref_get_many(pgmap->ref, (pfn_end(pgmap, range_id) > > + - pfn_first(pgmap, range_id)) / PHYS_PFN(pgmap->align)); > > Is there some reason that we cannot use range_len(), instead of pfn_end() minus > pfn_first()? (Yes, this more about the pre-existing code than about your change.) > > And if not, then why are the nearby range_len() uses OK? I realize that range_len() > is simpler and skips a case, but it's not clear that it's required here. But I'm > new to this area so be warned. :) > > Also, dividing by PHYS_PFN() feels quite misleading: that function does what you > happen to want, but is not named accordingly. Can you use or create something > more accurately named? Like "number of pages in this large page"? We have compound_nr(), but that takes a struct page as an argument. We also have HPAGE_NR_PAGES. I'm not quite clear what you want.