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.8 required=3.0 tests=BAYES_00, 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 2643BC4320A for ; Tue, 31 Aug 2021 18:51:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D028261075 for ; Tue, 31 Aug 2021 18:51:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D028261075 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xmission.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3A2308D0003; Tue, 31 Aug 2021 14:51:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32B388D0001; Tue, 31 Aug 2021 14:51:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CB618D0003; Tue, 31 Aug 2021 14:51:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 069C28D0001 for ; Tue, 31 Aug 2021 14:51:11 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A1E47276EB for ; Tue, 31 Aug 2021 18:51:10 +0000 (UTC) X-FDA: 78536268300.03.969045D Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by imf28.hostedemail.com (Postfix) with ESMTP id 40D36900009E for ; Tue, 31 Aug 2021 18:51:10 +0000 (UTC) Received: from in02.mta.xmission.com ([166.70.13.52]:48582) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mL8qg-005rv9-7n; Tue, 31 Aug 2021 12:51:06 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:39628 helo=email.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mL8qd-005khz-UH; Tue, 31 Aug 2021 12:51:05 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Johannes Weiner Cc: Matthew Wilcox , "Darrick J. Wong" , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton References: <20210826004555.GF12597@magnolia> Date: Tue, 31 Aug 2021 13:50:35 -0500 In-Reply-To: (Johannes Weiner's message of "Mon, 30 Aug 2021 16:27:04 -0400") Message-ID: <87r1e95tz8.fsf@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1mL8qd-005khz-UH;;;mid=<87r1e95tz8.fsf@disp2133>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18eKAe35NzalvMqaiLGi59y7wlKRtQmiJs= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [GIT PULL] Memory folios for v5.15 X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of ebiederm@xmission.com designates 166.70.13.232 as permitted sender) smtp.mailfrom=ebiederm@xmission.com; dmarc=pass (policy=none) header.from=xmission.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 40D36900009E X-Stat-Signature: 7fb7udoxsstcafyc1jq4pjaa5o8zzmxx X-HE-Tag: 1630435870-451446 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: Johannes Weiner writes: > On Mon, Aug 30, 2021 at 07:22:25PM +0100, Matthew Wilcox wrote: >> On Mon, Aug 30, 2021 at 01:32:55PM -0400, Johannes Weiner wrote: >> > > The mistake you're making is coupling "minimum mapping granularity" with >> > > "minimum allocation granularity". We can happily build a system which >> > > only allocates memory on 2MB boundaries and yet lets you map that memory >> > > to userspace in 4kB granules. >> > >> > Yeah, but I want to do it without allocating 4k granule descriptors >> > statically at boot time for the entirety of available memory. >> >> Even that is possible when bumping the PAGE_SIZE to 16kB. It needs a >> bit of fiddling: >> >> static int insert_page_into_pte_locked(struct mm_struct *mm, pte_t *pte, >> unsigned long addr, struct page *page, pgprot_t prot) >> { >> if (!pte_none(*pte)) >> return -EBUSY; >> /* Ok, finally just insert the thing.. */ >> get_page(page); >> inc_mm_counter_fast(mm, mm_counter_file(page)); >> page_add_file_rmap(page, false); >> set_pte_at(mm, addr, pte, mk_pte(page, prot)); >> return 0; >> } >> >> mk_pte() assumes that a struct page refers to a single pte. If we >> revamped it to take (page, offset, prot), it could construct the >> appropriate pte for the offset within that page. > > Right, page tables only need a pfn. The struct page is for us to > maintain additional state about the object. > > For the objects that are subpage sized, we should be able to hold that > state (shrinker lru linkage, referenced bit, dirtiness, ...) inside > ad-hoc allocated descriptors. > > Descriptors which could well be what struct folio {} is today, IMO. As > long as it doesn't innately assume, or will assume, in the API the > 1:1+ mapping to struct page that is inherent to the compound page. struct buffer_head any one? I am being silly but when you say you want something that isn't a page for caching that could be less than a page in size, it really sounds like you want struct buffer_head. The only actual problem I am aware of with struct buffer_head is that it is a block device abstraction and does not map well to other situations. Which makes network filesystems unable to use struct buffer_head. Eric