Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2358399pxb; Mon, 23 Aug 2021 19:23:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFPIXpdoQbDhykTD6R8y8pbXBxxmyX8mhmTyxeFUfxnlg7CZzqMh60+Et4R4m0duPkd/Ou X-Received: by 2002:a5e:961a:: with SMTP id a26mr29244287ioq.90.1629771826411; Mon, 23 Aug 2021 19:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629771826; cv=none; d=google.com; s=arc-20160816; b=gCq8h9OHIQMQtv8ljawY3Dnc1q+3dySa6Hi3PdPFUieykI63b9yQHlz7nIAoFCp8MM 2Bh1BNDrb2m7Gj5eSxJzp6wzsePIOgxRdrMM466YqV891usGIPBGkHyga2HI9nfNUzp8 F5XJiafGZopPdmMUQHe0Qr6zEh7Y04WQe8mzOp6o1VkHPucgtDk2Rpo1fu/aFFbyLg0k Ed3RRvnKc7N0FCs2UXE0jpM9vwcQ7kWcoCJQZFLMQvGwAqX9KhGQ1hypGT1qiqpwEJUO 8DZHSk0EEW/gjTv+/ktaqXuSYn0Z3RSMTf1S73eJKboDeAXgGxoVBTQ5dN0MtKpo5Y/x ILkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=w3YWD1YQ7yzJTuhmTwVKzCh8QAlpDX6ZrTlsUvoyX8U=; b=hTwkkGR0qENUY/jDEST+R/TkOTex1Q9vQAJEotDAKgGotqo9UUAGc7/kVIyHlFIBbS s/M7J81agRnwSABAsGu+EZO/kkpJCXXmxdCs9KjjurKa4TTIZZnkcobYA5zqg/w+XDnt Y1y5HCuG86APa4dYXMR2geCtwQa8qeNeGwqiZFQxbaIy5EISB41OWm0oyXxO95ooGTRv F2Kp7c8fjoYE7wrb9td77Lg0+knGGXsNDapYcQkS6DZpw+V2SRI5m2EEN5gGcBrOWoBg TyAj3f0qnFjFKrMditV8K5Hvx3iHOucTt52+l/cxWqtPy0FwInSmVvO8NmTFcChd7A5U 8QHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=M8bh9QnV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si17347638ios.26.2021.08.23.19.23.33; Mon, 23 Aug 2021 19:23:46 -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=@infradead.org header.s=casper.20170209 header.b=M8bh9QnV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233648AbhHXCWT (ORCPT + 99 others); Mon, 23 Aug 2021 22:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbhHXCWO (ORCPT ); Mon, 23 Aug 2021 22:22:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A007C061575; Mon, 23 Aug 2021 19:21:31 -0700 (PDT) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.