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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 E6913C55ABD for ; Fri, 13 Nov 2020 19:44:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 66CD92223F for ; Fri, 13 Nov 2020 19:44:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="W/YEs+X5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66CD92223F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A2C326B005C; Fri, 13 Nov 2020 14:44:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B6986B005D; Fri, 13 Nov 2020 14:44:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87D766B0068; Fri, 13 Nov 2020 14:44:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 5B10C6B005C for ; Fri, 13 Nov 2020 14:44:52 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F27772492 for ; Fri, 13 Nov 2020 19:44:51 +0000 (UTC) X-FDA: 77480422782.08.cream56_1b15c1927311 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id D2E4B1819E785 for ; Fri, 13 Nov 2020 19:44:51 +0000 (UTC) X-HE-Tag: cream56_1b15c1927311 X-Filterd-Recvd-Size: 4322 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Nov 2020 19:44:50 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 13 Nov 2020 11:44:53 -0800 Received: from [10.2.88.49] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 13 Nov 2020 19:44:42 +0000 Subject: Re: Are THPs the right model for the pagecache? To: Matthew Wilcox CC: , References: <20201113044652.GD17076@casper.infradead.org> <1c1fa264-41d8-49a4-e5ff-2a5bf03e711e@nvidia.com> <20201113123836.GE17076@casper.infradead.org> <20201113174409.GH17076@casper.infradead.org> From: John Hubbard Message-ID: Date: Fri, 13 Nov 2020 11:44:42 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201113174409.GH17076@casper.infradead.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1605296693; bh=JFgmU79FTdtVBVVQC7aaqHQgnrbx9oOyfd+bx1OA7pw=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=W/YEs+X5iq/BHCGrdClOpDihff5YD9yJjf5i6rywoZJDTsCI8izD/+1gPjqcOdN4m H5Zh7HLqmDuiQE5YRtnOal8fP9dfvy9Pe9ocKsRf3kn08SgFTs++DaLFQ+Hz6ogUSi gIsbzIbYeuWRo8yryO37ux5Br7CA+g54EIbtzrb0ev5vQ0O29MWp1ucvL7kiXDy35L J5TKYmnN2msT1MjjiMcen5RnVnOKkbgGBAmE2PPkCdsoCQ0UXiQSISxmNQHd7kV3vU dGPv2hpEVuJy9jgeo0ivKKJ+yFuyVyG8PNAJKpOQhYhpGFUT/HsLliY7uPVuWoGK8n HlgHrp8POgoiw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/13/20 9:44 AM, Matthew Wilcox wrote: > On Fri, Nov 13, 2020 at 12:38:36PM +0000, Matthew Wilcox wrote: >> So what if we had: >> >> /* Cache memory */ >> struct cmem { >> struct page pages[1]; >> }; > > OK, that's a terrible name. I went with 'folio' for this demonstration. > Other names suggested include album, sheaf and ream. +1 for "folio", that's a good name! It stands out, as it should, given that it's a different type. The others could work too, but this one is especially nice because there are no pre-existing uses in the kernel, so no baggage. And it's grep-able too. Your demo diff looks good to me, and I think it noticeably improves things and is worth doing. One tiny tweak first: The struct member should be named .page, rather than .pages. That's because pages in -mm usually refers to "struct page **", but here you've got a struct page *. Notice how the various odd things get better in the patch if you change it to .page: ... > +static inline atomic_t *folio_mapcount_ptr(struct folio *folio) > { > - return &page[1].compound_mapcount; > + return &folio->pages[1].compound_mapcount; See, this diff is changing from "page" to "pages", but we don't especially desire that, *and* it's arguably even more readable like this anyway: return &folio->page[1].compound_mapcount; and... ... > @@ -166,16 +167,16 @@ void __dump_page(struct page *page, const char *reason) > out_mapping: > BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > > - pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags, > - page_cma ? " CMA" : ""); > + pr_warn("%sflags: %#lx(%pGp)%s\n", type, folio->pages->flags, > + &(folio->pages->flags), page_cma ? " CMA" : ""); > > hex_only: > print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, > sizeof(unsigned long), page, > sizeof(struct page), false); > - if (head != page) > + if (folio->pages != page) This one in particular gets a lot better: if (folio->page != page) ...is much more natural. thanks, -- John Hubbard NVIDIA