Message ID | 20250219101559.414878-1-shivankg@amd.com (mailing list archive) |
---|---|
Headers | show |
Series | Add NUMA mempolicy support for KVM guest-memfd | expand |
On 2/19/2025 3:45 PM, Shivank Garg wrote: > KVM's guest-memfd memory backend currently lacks support for NUMA policy > enforcement, causing guest memory allocations to be distributed arbitrarily > across host NUMA nodes regardless of the policy specified by the VMM. This > occurs because conventional userspace NUMA control mechanisms like mbind() > are ineffective with guest-memfd, as the memory isn't directly mapped to > userspace when allocations occur. > > This patch-series adds NUMA binding capabilities to guest_memfd backend > KVM guests. It has evolved through several approaches based on community > feedback: > - v1,v2: Extended the KVM_CREATE_GUEST_MEMFD IOCTL to pass mempolicy. > - v3: Introduced fbind() syscall for VMM memory-placement configuration. > - v4,v5: Current approach using shared_policy support and vm_ops (based on > suggestions from David[1] and guest_memfd biweekly upstream call[2]). > <--snip> Hi All, This patch-series was discussed during the bi-weekly guest_memfd upstream call on 2025-02-20 [1]. Here are my notes from the discussion: The current design using mmap and shared_policy support with vm_ops appears good and aligns well with how shared memory handles NUMA policy. This makes perfect sense with upcoming changes from Fuad [2]. Integration with Fuad's work should be straightforward as my work primarily involves set_policy and get_policy callbacks in vm_ops. Additionally, this approach helps us avoid any fpolicy/fbind()[3] complexity. David mentioned documenting the behavior of setting memory policy after memory has already been allocated. Specifically, the policy change will only affect future allocations and will 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). In the future, we may explore supporting MPOL_MF_MOVE for guest_memfd, but for now, this behavior is sufficient and should be clearly documented. Before sending the non-RFC version of the patch-series, I will: - Document and clarify the memory allocation behavior after policy changes - Write kselftests to validate NUMA policy enforcement, including edge cases like changing policies after memory allocation I aim to send the updated patch-series soon. If there are any further suggestions or concerns, please let me know. [1] https://lore.kernel.org/linux-mm/40290a46-bcf4-4ef6-ae13-109e18ad0dfd@redhat.com [2] https://lore.kernel.org/linux-mm/20250218172500.807733-1-tabba@google.com [3] https://lore.kernel.org/linux-mm/20241105164549.154700-1-shivankg@amd.com Thanks, Shivank