[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c004de5-4132-49f2-bbf2-6a0517f25d58@intel.com>
Date: Fri, 16 May 2025 13:25:16 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"seanjc@...gle.com" <seanjc@...gle.com>
Cc: "palmer@...belt.com" <palmer@...belt.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"Miao, Jun" <jun.miao@...el.com>, "nsaenz@...zon.es" <nsaenz@...zon.es>,
"pdurrant@...zon.co.uk" <pdurrant@...zon.co.uk>,
"vbabka@...e.cz" <vbabka@...e.cz>, "peterx@...hat.com" <peterx@...hat.com>,
"x86@...nel.org" <x86@...nel.org>, "jack@...e.cz" <jack@...e.cz>,
"tabba@...gle.com" <tabba@...gle.com>,
"quic_svaddagi@...cinc.com" <quic_svaddagi@...cinc.com>,
"amoorthy@...gle.com" <amoorthy@...gle.com>, "pvorel@...e.cz"
<pvorel@...e.cz>, "vkuznets@...hat.com" <vkuznets@...hat.com>,
"mail@...iej.szmigiero.name" <mail@...iej.szmigiero.name>,
"Annapurve, Vishal" <vannapurve@...gle.com>,
"anthony.yznaga@...cle.com" <anthony.yznaga@...cle.com>,
"Wang, Wei W" <wei.w.wang@...el.com>, "keirf@...gle.com" <keirf@...gle.com>,
"Wieczor-Retman, Maciej" <maciej.wieczor-retman@...el.com>,
"Zhao, Yan Y" <yan.y.zhao@...el.com>,
"ajones@...tanamicro.com" <ajones@...tanamicro.com>,
"rppt@...nel.org" <rppt@...nel.org>,
"quic_mnalajal@...cinc.com" <quic_mnalajal@...cinc.com>,
"aik@....com" <aik@....com>,
"usama.arif@...edance.com" <usama.arif@...edance.com>,
"fvdl@...gle.com" <fvdl@...gle.com>,
"paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
"bfoster@...hat.com" <bfoster@...hat.com>,
"quic_cvanscha@...cinc.com" <quic_cvanscha@...cinc.com>,
"willy@...radead.org" <willy@...radead.org>, "Du, Fan" <fan.du@...el.com>,
"quic_eberman@...cinc.com" <quic_eberman@...cinc.com>,
"thomas.lendacky@....com" <thomas.lendacky@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"mic@...ikod.net" <mic@...ikod.net>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"steven.price@....com" <steven.price@....com>,
"muchun.song@...ux.dev" <muchun.song@...ux.dev>,
"binbin.wu@...ux.intel.com" <binbin.wu@...ux.intel.com>,
"Li, Zhiquan1" <zhiquan1.li@...el.com>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>,
"mpe@...erman.id.au" <mpe@...erman.id.au>,
"david@...hat.com" <david@...hat.com>, "jgg@...pe.ca" <jgg@...pe.ca>,
"hughd@...gle.com" <hughd@...gle.com>, "Xu, Haibo1" <haibo1.xu@...el.com>,
"jhubbard@...dia.com" <jhubbard@...dia.com>,
"anup@...infault.org" <anup@...infault.org>, "maz@...nel.org"
<maz@...nel.org>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"jthoughton@...gle.com" <jthoughton@...gle.com>,
"steven.sistare@...cle.com" <steven.sistare@...cle.com>,
"quic_pheragu@...cinc.com" <quic_pheragu@...cinc.com>,
"jarkko@...nel.org" <jarkko@...nel.org>,
"Shutemov, Kirill" <kirill.shutemov@...el.com>,
"chenhuacai@...nel.org" <chenhuacai@...nel.org>,
"Huang, Kai" <kai.huang@...el.com>, "shuah@...nel.org" <shuah@...nel.org>,
"dwmw@...zon.co.uk" <dwmw@...zon.co.uk>,
"pankaj.gupta@....com" <pankaj.gupta@....com>,
"Peng, Chao P" <chao.p.peng@...el.com>, "nikunj@....com" <nikunj@....com>,
"Graf, Alexander" <graf@...zon.com>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"yuzenghui@...wei.com" <yuzenghui@...wei.com>,
"jroedel@...e.de" <jroedel@...e.de>,
"suzuki.poulose@....com" <suzuki.poulose@....com>,
"jgowans@...zon.com" <jgowans@...zon.com>, "Xu, Yilun" <yilun.xu@...el.com>,
"liam.merwick@...cle.com" <liam.merwick@...cle.com>,
"michael.roth@....com" <michael.roth@....com>,
"quic_tsoni@...cinc.com" <quic_tsoni@...cinc.com>,
"richard.weiyang@...il.com" <richard.weiyang@...il.com>,
"Weiny, Ira" <ira.weiny@...el.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
"Li, Xiaoyao" <xiaoyao.li@...el.com>, "qperret@...gle.com"
<qperret@...gle.com>, "kent.overstreet@...ux.dev"
<kent.overstreet@...ux.dev>, "dmatlack@...gle.com" <dmatlack@...gle.com>,
"james.morse@....com" <james.morse@....com>,
"brauner@...nel.org" <brauner@...nel.org>,
"hch@...radead.org" <hch@...radead.org>,
"ackerleytng@...gle.com" <ackerleytng@...gle.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"pgonda@...gle.com" <pgonda@...gle.com>,
"quic_pderrin@...cinc.com" <quic_pderrin@...cinc.com>,
"roypat@...zon.co.uk" <roypat@...zon.co.uk>,
"will@...nel.org" <will@...nel.org>, "linux-mm@...ck.org"
<linux-mm@...ck.org>
Subject: Re: [RFC PATCH v2 00/51] 1G page support for guest_memfd
On 5/16/25 12:14, Edgecombe, Rick P wrote:
> Meanwhile I'm watching patches to make 5 level paging walks unconditional fly by
> because people couldn't find a cost to the extra level of walk. So re-litigate,
> no. But I'll probably remain quietly suspicious of the exact cost/value. At
> least on the CPU side, I totally missed the IOTLB side at first, sorry.
It's a little more complicated than just the depth of the worst-case walk.
In practice, many page walks can use the mid-level paging structure
caches because the mappings aren't sparse.
With 5-level paging in particular, userspace doesn't actually change
much at all. Its layout is pretty much the same unless folks are opting
in to the higher (5-level only) address space. So userspace isn't
sparse, at least at the scale of what 5-level paging is capable of.
For the kernel, things are a bit more spread out than they were before.
For instance, the direct map and vmalloc() are in separate p4d pages
when they used to be nestled together in the same half of one pgd.
But, again, they're not *that* sparse. The direct map, for example,
doesn't become more sparse, it just moves to a lower virtual address.
Ditto for vmalloc(). Just because 5-level paging has a massive
vmalloc() area doesn't mean we use it.
Basically, 5-level paging adds a level to the top of the page walk, and
we're really good at caching those when they're not accessed sparsely.
CPUs are not as good at caching the leaf side of the page walk. There
are tricks like AMD's TLB coalescing that help. But, generally, each
walk on the leaf end of the walks eats a TLB entry. Those just don't
cache as well as the top of the tree.
That's why we need to be more maniacal about reducing leaf levels than
the levels toward the root.
Powered by blists - more mailing lists