[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <651d0f59-990d-460e-829b-be5cb1ee7fe7@suse.cz>
Date: Mon, 21 Jul 2025 15:30:19 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Shivank Garg <shivankg@....com>, seanjc@...gle.com, david@...hat.com,
willy@...radead.org, akpm@...ux-foundation.org, shuah@...nel.org,
pbonzini@...hat.com, brauner@...nel.org, viro@...iv.linux.org.uk
Cc: ackerleytng@...gle.com, paul@...l-moore.com, jmorris@...ei.org,
serge@...lyn.com, pvorel@...e.cz, bfoster@...hat.com, tabba@...gle.com,
vannapurve@...gle.com, chao.gao@...el.com, bharata@....com, nikunj@....com,
michael.day@....com, shdhiman@....com, yan.y.zhao@...el.com,
Neeraj.Upadhyay@....com, thomas.lendacky@....com, michael.roth@....com,
aik@....com, jgg@...dia.com, kalyazin@...zon.com, peterx@...hat.com,
jack@...e.cz, rppt@...nel.org, hch@...radead.org, cgzones@...glemail.com,
ira.weiny@...el.com, rientjes@...gle.com, roypat@...zon.co.uk,
ziy@...dia.com, matthew.brost@...el.com, joshua.hahnjy@...il.com,
rakie.kim@...com, byungchul@...com, gourry@...rry.net,
kent.overstreet@...ux.dev, ying.huang@...ux.alibaba.com, apopple@...dia.com,
chao.p.peng@...el.com, amit@...radead.org, ddutile@...hat.com,
dan.j.williams@...el.com, ashish.kalra@....com, gshan@...hat.com,
jgowans@...zon.com, pankaj.gupta@....com, papaluri@....com,
yuzhao@...gle.com, suzuki.poulose@....com, quic_eberman@...cinc.com,
aneeshkumar.kizhakeveetil@....com, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-coco@...ts.linux.dev
Subject: Re: [PATCH V9 6/7] KVM: guest_memfd: Enforce NUMA mempolicy using
shared policy
On 7/13/25 19:43, Shivank Garg wrote:
> Previously, guest-memfd allocations followed local NUMA node id in absence
> of process mempolicy, resulting in arbitrary memory allocation.
> Moreover, mbind() couldn't be used by the VMM as guest memory wasn't
> mapped into userspace when allocation occurred.
>
> Enable NUMA policy support by implementing vm_ops for guest-memfd mmap
> operation. This allows the VMM to map the memory and use mbind() to set the
> desired NUMA policy. The policy is stored in the inode structure via
> kvm_gmem_inode_info, as memory policy is a property of the memory (struct
> inode) itself. The policy is then retrieved via mpol_shared_policy_lookup()
> and passed to filemap_grab_folio_mpol() to ensure that allocations follow
> the specified memory policy.
>
> This enables the VMM to control guest memory NUMA placement by calling
> mbind() on the mapped memory regions, providing fine-grained control over
> guest memory allocation across NUMA nodes.
>
> The policy change only affect future allocations and does not migrate
> existing memory. This matches mbind(2)'s default behavior which affects
> only new allocations unless overridden with MPOL_MF_MOVE/MPOL_MF_MOVE_ALL
> flags, which are not supported for guest_memfd as it is unmovable.
>
> Suggested-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Shivank Garg <shivankg@....com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
Powered by blists - more mailing lists