[f2fs-dev] [PATCH V2 1/2] mm/filemap: Add NUMA mempolicy support to filemap_alloc_folio()

2025-06-23 Thread Shivank Garg via Linux-f2fs-devel
From: "Matthew Wilcox (Oracle)" Add a mempolicy parameter to filemap_alloc_folio() to enable NUMA-aware page cache allocations. This will be used by upcoming changes to support NUMA policies in guest-memfd, where guest_memory needs to be allocated according to NUMA policy specified by the VMM. A

[f2fs-dev] [PATCH V2 2/2] mm/filemap: Extend __filemap_get_folio() to support NUMA memory policies

2025-06-23 Thread Shivank Garg via Linux-f2fs-devel
From: "Matthew Wilcox (Oracle)" Extend __filemap_get_folio() to support NUMA memory policies by renaming the implementation to __filemap_get_folio_mpol() and adding a mempolicy parameter. The original function becomes a static inline wrapper that passes NULL for the mempolicy. This infrastructur

[f2fs-dev] [PATCH kvm-next V11 2/7] mm/filemap: Extend __filemap_get_folio() to support NUMA memory policies

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
From: "Matthew Wilcox (Oracle)" Extend __filemap_get_folio() to support NUMA memory policies by renaming the implementation to __filemap_get_folio_mpol() and adding a mempolicy parameter. The original function becomes a static inline wrapper that passes NULL for the mempolicy. This infrastructur

[f2fs-dev] [PATCH kvm-next V11 4/7] KVM: guest_memfd: Use guest mem inodes instead of anonymous inodes

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
From: Ackerley Tng guest_memfd's inode represents memory the guest_memfd is providing. guest_memfd's file represents a struct kvm's view of that memory. Using a custom inode allows customization of the inode teardown process via callbacks. For example, ->evict_inode() allows customization of the

[f2fs-dev] [PATCH kvm-next V11 5/7] KVM: guest_memfd: Add slab-allocated inode cache

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
Add dedicated inode structure (kvm_gmem_inode_info) and slab-allocated inode cache for guest memory backing, similar to how shmem handles inodes. This adds the necessary allocation/destruction functions and prepares for upcoming guest_memfd NUMA policy support changes. Signed-off-by: Shivank Garg

[f2fs-dev] [PATCH kvm-next V11 1/7] mm/filemap: Add NUMA mempolicy support to filemap_alloc_folio()

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
From: "Matthew Wilcox (Oracle)" Add a mempolicy parameter to filemap_alloc_folio() to enable NUMA-aware page cache allocations. This will be used by upcoming changes to support NUMA policies in guest-memfd, where guest_memory need to be allocated NUMA policy specified by VMM. All existing users

[f2fs-dev] [PATCH kvm-next V11 6/7] KVM: guest_memfd: Enforce NUMA mempolicy using shared policy

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
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 implementin

[f2fs-dev] [PATCH kvm-next V11 0/7] Add NUMA mempolicy support for KVM guest-memfd

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
This series introduces NUMA-aware memory placement support for KVM guests with guest_memfd memory backends. It builds upon Fuad Tabba's work (V17) that enabled host-mapping for guest_memfd memory [1] and can be applied directly applied on KVM tree [2] (branch kvm-next, base commit: a6ad5413, Merge

[f2fs-dev] [PATCH kvm-next V11 3/7] mm/mempolicy: Export memory policy symbols

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
KVM guest_memfd wants to implement support for NUMA policies just like shmem already does using the shared policy infrastructure. As guest_memfd currently resides in KVM module code, we have to export the relevant symbols. In the future, guest_memfd might be moved to core-mm, at which point the sy

[f2fs-dev] [PATCH kvm-next V11 7/7] KVM: guest_memfd: selftests: Add tests for mmap and NUMA policy support

2025-08-27 Thread Shivank Garg via Linux-f2fs-devel
Add tests for NUMA memory policy binding and NUMA aware allocation in guest_memfd. This extends the existing selftests by adding proper validation for: - KVM GMEM set_policy and get_policy() vm_ops functionality using mbind() and get_mempolicy() - NUMA policy application before and after memory a