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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BAECE7717D for ; Wed, 11 Dec 2024 15:45:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6B646B0092; Wed, 11 Dec 2024 10:45:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C1B166B0093; Wed, 11 Dec 2024 10:45:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABAFC6B009C; Wed, 11 Dec 2024 10:45:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8D12C6B0092 for ; Wed, 11 Dec 2024 10:45:41 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F3734A0F10 for ; Wed, 11 Dec 2024 15:45:40 +0000 (UTC) X-FDA: 82883101602.17.F4F6EBA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 30E6C18000F for ; Wed, 11 Dec 2024 15:45:14 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Y7xOQMC2; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733931921; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V5qoWZsC18tWPEtDv9rsAwzOjBjfAF9LwBRk9pdBbRw=; b=BJXhDXOyvyTtRoyyLVwCCrQ+8wFYtxc1ITj1GO+6aJmW883ekc5cBgAKqCkujb9QI1Bjk6 3uo1JCUTgQdceOEsmGNHC9wZd+cpuSTjNncPvV0GeqK8LWok+2DnT1wIHJcYE8dtPqWRMJ OsT/ALiqfgtiVx6Up0Qv6tUF33AOuis= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Y7xOQMC2; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733931921; a=rsa-sha256; cv=none; b=v7uYElvaLffL89Tjj+OurhhhoJrjJhqjfziG+Rw3Bwtu4WJoRclrWHF7Be+ZraQVeS0o5k BBc8vSNcn/ibfydV00FFnuaonxcK0P7Wz6YhMSzAz40gQkkqQaICqR7KwCRPvfC/Y0PNtt j0+yQYrXDke31Aqiux0ORkvfdaAsQUM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=V5qoWZsC18tWPEtDv9rsAwzOjBjfAF9LwBRk9pdBbRw=; b=Y7xOQMC2ixpvouA30le3eebJ4O 1CekfneTr4eRAqdprZ9Ihs9agyonPYkRn3TSUuP2RDsL4gMuL86kDYk8PkQxK6NBz1mJGAwmCER34 JiqG8QqPFpVxTz1iUkWFvO8jPvY+zk8SWfKnK/WcOO6r1c+aSya9wKGcv7+t8jAHCQYXHjnFohYD/ qIFIW0mYlQp0zQsbnwgH0RAIRhF2U3O1PGUtPPgj6WvIb2QBgmE6mOW00rySU697yfeSpkEwY6Flp lQrrA9QnQnz9z9YB8Gl/xXYX1PBHMVE4oUuZbTdSkZ1CQQkkvVtFvMlLRbQhWaNro2HUZ7J8LZfp9 9jPSaBFA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tLOu8-0000000GuOA-09W0; Wed, 11 Dec 2024 15:45:36 +0000 Date: Wed, 11 Dec 2024 15:45:35 +0000 From: Matthew Wilcox To: David Hildenbrand Cc: Ryan Roberts , "linux-mm@kvack.org" Subject: Re: The future of PageAnonExclusive Message-ID: References: <9c2a17af-4df8-42f0-93c8-83133b6104fd@redhat.com> <3a9e7c3b-7b69-4f16-80ea-b1a0d4dba853@redhat.com> <41e5c2c6-01bb-40ab-a7bf-5b4e827377f8@arm.com> <9378073b-06bb-47b4-8435-32aba67d5845@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9378073b-06bb-47b4-8435-32aba67d5845@redhat.com> X-Rspamd-Queue-Id: 30E6C18000F X-Rspamd-Server: rspam12 X-Stat-Signature: jisxdbaqsxn3gc6jsse7rxkspk9xemig X-Rspam-User: X-HE-Tag: 1733931914-309312 X-HE-Meta: U2FsdGVkX19wneg4D8IDn6B3SKDDCM5CQMYO4QU7Qz3dk6HL1QgKr70Joa2irJ4UBkJn5XViCANyaM8vlJ2SIlt4syP/n+tmvfOE9r2VwZCvjZ9ImGcKRzPFcXX2qZRS6XbXJ0g+8n6hpv7jzmTIohh7j8xNFwLEgXTMPI/7/4mwmgUWUAWImgCCFoEZ4zd6FIu5SDlAPwDH2E9MUp/+yfPY8qT6tC3F+T+KshIh+IAHGyna2eZBNeoxhwXnfpdRg2lHWlu+bZzV2DMzNPTHk9MT43KqiSS31+8MQPsZ3PMPL5+u1be+minDs4nFxSxyCx3RvMTnACLMv8+76xS/PDOwnrc7JNVW1AGmjB+do/aTNAllh4RhZpBeu8X719zYyVhKLKtwmY4F0YVFHYnFSQddeGRpeodcWZH23e38Usjw7oKFTFccrB62p3PHkzEDQA+DmbNWEiD7ObXUfPzzzCs0rrLJSS28tAvURhUfycvLWOBbjp0OJURjrEgB0A3NE7vzcBGF9Ve0MASCDGH+z0B8qEyfxjvuPrqF73mH9myTG3Sgs4nzhS4MjfUwGt0I8L3LWzLPw61Eg9hLB5emni9XDeNpwj1c3PIZzPs45eUWJtr843EIckzQBcdozz46rkG9OeeSZVJpytDeiOlaKY6HvsdlAMKTRIjzI6w8aX8vNthKCKDbBBv58DaYWNP75vWQ5jNKl/4xA4zZa1rX37Y7hON9WQZaButlGkAVhemBPJZYUyOcRuIJ6SPyJQmxqVWRaDBAkbwSLrbcx7L7DdXYis3SdxqQMrnuA1vEmD7Lyt4l5YPPfumn0ZC6sqSCaQlkWuRxGErPXavyNy57ygn81/ULcDOPYjxEs1eg7LL4bBbl78Jvw8kwf74Y/niK2OsMeDOsuof94NMXAIYU1hBXpeJZUd0U9LYPMGcrSj8VYoqzq13ELGg9dEGWvAkBIRf9gDMtcArpQinqdWR k8dFT6Ul sFpPu8wYj8TNy6LC1G//D4P1ABaqOT+QhnWU78SMTsz8vPTAAIBQvzAwgBGFD74HpXmDjSHQPSrsUSxnqOhRN+JgJQam9TRCNHmWwwqI0E/glManuHQLYpA4NdbHVwK6qo2rjOcYbe596aaFt8kjpjQJtIzgpehpCO/pwGvXM7nMgrDCLk65NTswQQORRe8RtF30QAoEoJ3THCgYJK4vg9DEkWDNalFgo/DO3Qz2EGLC6tSdFgGhqZRJhWm+A4JXYVwzJYvJW+pdNncDV3rjgCUDmuxN7/Tx2Lq3PCN+vasmvhH5uNxe+imGxlWY6p09plx/BW1Hsc81BhgCFrUl5Kp3u77wNOUaXBTuj 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: List-Subscribe: List-Unsubscribe: On Wed, Dec 11, 2024 at 03:49:12PM +0100, David Hildenbrand wrote: > On 11.12.24 15:25, Ryan Roberts wrote: > > On 11/12/2024 11:56, David Hildenbrand wrote: > > > Now CCing the correct Willy :) > > > > > > On 11.12.24 12:55, David Hildenbrand wrote: > > > > Hi, > > > > > > > > PageAnonExclusive (PAE) is working very reliable at this point. But > > > > especially in the context of THPs (large folios) we'd like to do better: > > > > > > > > (1) For PTE-mapped THP, we have to maintain it per page. We'd like to > > > >       avoid per-page flags as good as possible (e.g., waste in "struct > > > >       page",  touching many cachelines). > > > > Presumably also important for the Glorious Future where struct page is just a > > pointer and struct folio (et al) is allocated dynamically? > > I think Willy mentioned that there might be ways to encode it in the 8-byte > for the "tail" pages. Yes. For anon memory, the page->memdesc has a 4-bit 'type' and the remaining 60 bits is a pointer to a struct folio (allocated from a slab with 16 byte alignment). The current list of types [1] has file folios as type 2 and anon folios as type 3. We could allocate a type to be 'anon exclusive', thus essentially giving us an anon-exclusive bit. [1] https://kernelnewbies.org/MatthewWilcox/Memdescs Don't get too excited about "we're almost out of types". The "managed" type has subtypes. We could also collapse "file" and "anon" into a single type and distinguish between them with a bit in the folio. Anyway, yes, we can do one per-page flag. Two per-page flags starts to get dicey.