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 4AF74C4338F for ; Tue, 24 Aug 2021 02:21:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5655608FE for ; Tue, 24 Aug 2021 02:21:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C5655608FE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EE81F6B006C; Mon, 23 Aug 2021 22:21:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E98978D0001; Mon, 23 Aug 2021 22:21:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D86E36B0072; Mon, 23 Aug 2021 22:21:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id BA67B6B006C for ; Mon, 23 Aug 2021 22:21:23 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 662478249980 for ; Tue, 24 Aug 2021 02:21:23 +0000 (UTC) X-FDA: 78508372446.34.BA2A002 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id A6B361000099 for ; Tue, 24 Aug 2021 02:21:22 +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=w3YWD1YQ7yzJTuhmTwVKzCh8QAlpDX6ZrTlsUvoyX8U=; b=M8bh9QnVXsa2B22/luwUvosuoq 3POH1pQHw64iMgvVdeifyHHUc/kPPgLkE5xvmMAIsrxLx4BTAVWPF0wcoVobVv4PakX4F0yadjCXZ cgSgj9xae/UtiRvs+RtT8tqdByBiyvruXQGWJhnNLdP0VYNhryO6OkJn1BLSKYlStL1nRXtVywueb wzGm1T6E2iIPsyJA9DNm/RkVRhJeLh6mWP7NQ2oTnqUCFfEIEsGY+TWwE+fzRGvazF5WSYyRwBvrn WsN+OOhYW7rIH83g03B0ghqj9HRkdcAnTzpvlGALID3/yg/Kjz6JtR/KK1NnOHCfpCZXZaVjmHBL8 0cGKXDNQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIM3V-00AR03-14; Tue, 24 Aug 2021 02:20:58 +0000 Date: Tue, 24 Aug 2021 03:20:48 +0100 From: Matthew Wilcox To: Linus Torvalds Cc: Johannes Weiner , Linux-MM , linux-fsdevel , Linux Kernel Mailing List , Andrew Morton Subject: Re: [GIT PULL] Memory folios for v5.15 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: A6B361000099 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=M8bh9QnV; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam01 X-Stat-Signature: jus53cxxa598hoc9zn81tei6yzf1i876 X-HE-Tag: 1629771682-655839 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 Mon, Aug 23, 2021 at 03:06:08PM -0700, Linus Torvalds wrote: > On Mon, Aug 23, 2021 at 2:25 PM Johannes Weiner wrote: > > > > One one hand, the ambition appears to substitute folio for everything > > that could be a base page or a compound page even inside core MM > > code. Since there are very few places in the MM code that expressly > > deal with tail pages in the first place, this amounts to a conversion > > of most MM code - including the LRU management, reclaim, rmap, > > migrate, swap, page fault code etc. - away from "the page". > > Yeah, honestly, I would have preferred to see this done the exact > reverse way: make the rule be that "struct page" is always a head > page, and anything that isn't a head page would be called something > else. > > Because, as you say, head pages are the norm. And "folio" may be a > clever term, but it's not very natural. Certainly not at all as > intuitive or common as "page" as a name in the industry. > > That said, I see why Willy did it the way he did - it was easier to do > it incrementally the way he did. But I do think it ends up with an end > result that is kind of topsy turvy where the common "this is the core > allocation" being called that odd "folio" thing, and then the simpler > "page" name is for things that almost nobody should even care about. > > I'd have personally preferred to call the head page just a "page", and > other pages "subpage" or something like that. I think that would be > much more intuitive than "folio/page". I'm trying to figure out how we can get there. To start, define struct mmu_page { union { struct page; struct { unsigned long flags; unsigned long compound_head; unsigned char compound_dtor; unsigned char compound_order; atomic_t compound_mapcount; unsigned int compound_nr; }; }; }; Now memmap becomes an array of struct mmu_pages instead of struct pages. We also need to sort out the type returned from the page cache APIs. Right now, it returns (effectively) the mmu_page. I think it _should_ return the (arbitrary order) struct page, but auditing every caller of every function is an inhuman job. I can't see how to get there from here without a ridiculous number of bugs. Maybe you can.