From: Gregory Price <gourry@gourry.net>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-mm@kvack.org, kvm@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, pbonzini@redhat.com, seanjc@google.com,
akpm@linux-foundation.org, ziy@nvidia.com,
matthew.brost@intel.com, joshua.hahnjy@gmail.com,
rakie.kim@sk.com, byungchul@sk.com,
ying.huang@linux.alibaba.com, apopple@nvidia.com,
shuah@kernel.org
Subject: Re: [PATCH 0/5] KVM: guest_memfd: bind backing memory to a NUMA node
Date: Thu, 10 Sep 2026 10:46:59 -0400 [thread overview]
Message-ID: <aqK6aj44Tn3bilry@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <6285ebc9-fee5-4f51-9ce6-b840f9dba65a@kernel.org>
On Thu, Sep 10, 2026 at 04:05:36PM +0200, David Hildenbrand (Arm) wrote:
> On 9/10/26 15:40, Gregory Price wrote:
> > On Thu, Sep 10, 2026 at 01:30:04PM +0200, David Hildenbrand (Arm) wrote:
> >> On 9/2/26 21:46, Gregory Price wrote:
> >>> guest_memfd allocates its folios through a per-inode shared mempolicy.
> >>>
> >>> Today that policy can only be set after the fact, with mbind() on a host
> >>> mmap of the fd. That requires the fd to be mappable, and it cannot reach
> >>> folios that are only ever guest-faulted. Neither holds for a
> >>> non-mappable (confidential) guest_memfd.
> >>
> >> That looks like an investment into a mechanism we will soon consider legacy, so
> >> I am not convinced this is the right approach?
> >>
> >
> > Hm, I think i've missed recent work in this space / this context.
> > Any suggested reading here? Don't want to eat too much of your time.
>
> So the big development happening right now is in-place conversion (having shared
> and private pages managed in guest_memfd):
>
> https://lore.kernel.org/r/20260830-gmem-inplace-conversion-v12-0-85e5fd25252a@google.com
>
>
> The final series where we added mempolicy support should be:
>
> https://lore.kernel.org/linux-mm/20250827175247.83322-2-shivankg@amd.com/
>
> (I think you are aware of that, you commented on some)
>
> See my other reply regarding the use of GUEST_MEMFD_FLAG_MMAP on private-only
> guest_memfd.
>
Ah yes, i do remember this series. In fact...
https://lore.kernel.org/linux-mm/aPD-dbl5KWNSHu5R@gourry-fedora-PF4VCD3F/
```
So this inode mempolicy in guest_memfd is really acting more as a the
filesystem-default mempolicy, which you want to survive even if userland
never maps the memory/unmaps the memory.
So the relationship is more like
guest_memfd -> creates fd/inode <- copies task mempolicy (if set)
vm: allocates memory via filemap_get_folio_mpol()
userland mmap(fd):
creates new inode<->vma mapping
vma->mpol = kvm_gmem_get_policy()
calls to set/get_policy/mbind go through kvm_gmem
```
And quick skim of in-place conversion (wow that's dense)
```
#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
Set attributes for a range of offsets within a guest_memfd to
KVM_MEMORY_ATTRIBUTE_PRIVATE to limit the specified guest_memfd backed
memory range for guest use. Even if KVM_CAP_GUEST_MEMFD_MMAP is
supported, after a successful call to set KVM_MEMORY_ATTRIBUTE_PRIVATE,
the requested range will not be mappable into host userspace and will
only be mappable by the guest.
```
I guess the thought here would be something like...
1. create guest memfd
2. mmap(fd) -> prior to full guest setup
3. mbind(buf) -> shared policy hits the inode
4. munmap(buf) -> policy is NOT reaped
5. set ATTRIBUTE_PRIVATE
6. no longer user mappable
That doesn't seem unreasonable
~Gregory
prev parent reply other threads:[~2026-09-10 14:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 19:46 [PATCH 0/5] KVM: guest_memfd: bind backing memory to a NUMA node Gregory Price
2026-09-02 19:46 ` [PATCH 1/5] mm/mempolicy: add mempolicy_create() Gregory Price
2026-09-02 19:46 ` [PATCH 2/5] mm/mempolicy: add mpol_set_shared_policy_range() Gregory Price
2026-09-02 19:46 ` [PATCH 3/5] KVM: guest_memfd: bind backing memory to a NUMA node at creation Gregory Price
2026-09-02 20:00 ` sashiko-bot
2026-09-02 19:46 ` [PATCH 4/5] selftests: KVM: guest_memfd: let the gmem_test() harness bind a node Gregory Price
2026-09-02 19:59 ` sashiko-bot
2026-09-02 19:46 ` [PATCH 5/5] selftests: KVM: guest_memfd: test GUEST_MEMFD_FLAG_BIND_NODE Gregory Price
2026-09-02 20:04 ` sashiko-bot
2026-09-09 22:41 ` [PATCH 0/5] KVM: guest_memfd: bind backing memory to a NUMA node Ackerley Tng
2026-09-09 23:10 ` Gregory Price
2026-09-09 23:23 ` Ackerley Tng
2026-09-09 23:41 ` Gregory Price
2026-09-10 11:32 ` David Hildenbrand (Arm)
2026-09-10 13:39 ` Gregory Price
2026-09-10 14:00 ` David Hildenbrand (Arm)
2026-09-10 11:30 ` David Hildenbrand (Arm)
2026-09-10 13:40 ` Gregory Price
2026-09-10 14:05 ` David Hildenbrand (Arm)
2026-09-10 14:46 ` Gregory Price [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqK6aj44Tn3bilry@gourry-fedora-PF4VCD3F \
--to=gourry@gourry.net \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=david@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=kernel-team@meta.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=pbonzini@redhat.com \
--cc=rakie.kim@sk.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.