Re: [RFC PATCH 0/2] Add flag as THP allocation hint for memfd_restricted() syscall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yuan Yao <yuan.yao@xxxxxxxxxxxxxxx> writes:

On Sat, Feb 18, 2023 at 12:43:00AM +0000, Ackerley Tng wrote:
Hello,

This patchset builds upon the memfd_restricted() system call that has
been discussed in the ‘KVM: mm: fd-based approach for supporting KVM’
patch series, at
https://lore.kernel.org/lkml/20221202061347.1070246-1-chao.p.peng@xxxxxxxxxxxxxxx/T/#m7e944d7892afdd1d62a03a287bd488c56e377b0c

The tree can be found at:
https://github.com/googleprodkernel/linux-cc/tree/restrictedmem-rmfd-hugepage

Following the RFC to provide mount for memfd_restricted() syscall at
https://lore.kernel.org/lkml/cover.1676507663.git.ackerleytng@xxxxxxxxxx/T/#u,
this patchset adds the RMFD_HUGEPAGE flag to the memfd_restricted()
syscall, which will hint the kernel to use Transparent HugePages to
back restrictedmem pages.

This supplements the interface proposed earlier, which requires the
creation of a tmpfs mount to be passed to memfd_restricted(), with a
more direct per-file hint.

Dependencies:

+ Sean’s iteration of the ‘KVM: mm: fd-based approach for supporting
   KVM’ patch series at
   https://github.com/sean-jc/linux/tree/x86/upm_base_support
+ Proposed fix for restrictedmem_getattr() as mentioned on the mailing
   list at
https://lore.kernel.org/lkml/diqzzga0fv96.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
+ Hugh’s patch:
https://lore.kernel.org/lkml/c140f56a-1aa3-f7ae-b7d1-93da7d5a3572@xxxxxxxxxx/,
   which provides functionality in shmem that reads the VM_HUGEPAGE
   flag in key functions shmem_is_huge() and shmem_get_inode()

Will Hugh's patch be merged into 6.3 ? I didn't find it in 6.2-rc8.
IMHO this patch won't work without Hugh's patch, or at least need
another way, e.g. HMEM_SB(inode->i_sb)->huge.


Hugh's patch is still pending discussion and may not be merged so
soon. These patches will not work without Hugh's patch.

I would like to understand what the community thinks of the proposed
interface (RMFD_HUGEPAGE flag, passed to the memfd_restricted()
syscall). If this interface is favorably received, we can definitely
find another way for shmem to support this interface.

If I understand correctly, SHMEM_SB(inode->i_sb)->huge checks the state
of hugepage-ness for the superblock. Since the proposed interface will
only affect a single file, we will need something closer to

    bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
                       pgoff_t index, bool shmem_huge_force)
    {
            ...

            if (SHMEM_I(inode)->flags & VM_HUGEPAGE)
                    return true;

            ...
    }

from Hugh's patch.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux