[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 04/14] mm/shmem: Support memfile_notifier
From: |
Chao Peng |
Subject: |
Re: [PATCH v7 04/14] mm/shmem: Support memfile_notifier |
Date: |
Thu, 14 Jul 2022 07:49:03 +0800 |
On Wed, Jul 13, 2022 at 12:01:13PM +0200, Gupta, Pankaj wrote:
>
> > > > +#ifdef CONFIG_MIGRATION
> > > > +static int shmem_migrate_page(struct address_space *mapping,
> > > > + struct page *newpage, struct page *page,
> > > > + enum migrate_mode mode)
> > > > +{
> > > > + struct inode *inode = mapping->host;
> > > > + struct shmem_inode_info *info = SHMEM_I(inode);
> > > > +
> > > > + if (info->memfile_node.flags & MEMFILE_F_UNMOVABLE)
> > > > + return -EOPNOTSUPP;
> > > > + return migrate_page(mapping, newpage, page, mode);
> > >
> > > Wondering how well page migrate would work for private pages
> > > on shmem memfd based backend?
> >
> > From high level:
> > - KVM unset MEMFILE_F_UNMOVABLE bit to indicate it capable of
> > migrating a page.
> > - Introduce new 'migrate' callback(s) to memfile_notifier_ops for KVM
> > to register.
> > - The callback is hooked to migrate_page() here.
> > - Once page migration requested, shmem calls into the 'migrate'
> > callback(s) to perform additional steps for encrypted memory (For
> > TDX we will call TDH.MEM.PAGE.RELOCATE).
>
> Yes, that would require additional (protocol specific) handling for private
> pages. Was trying to find where "MEMFILE_F_UNMOVABLE" flag is set currently?
It's set with memfile_register_notifier() in patch 13.
>
> Thanks,
> Pankaj
[PATCH v7 02/14] selftests/memfd: Add tests for F_SEAL_AUTO_ALLOCATE, Chao Peng, 2022/07/06
[PATCH v7 03/14] mm: Introduce memfile_notifier, Chao Peng, 2022/07/06
[PATCH v7 04/14] mm/shmem: Support memfile_notifier, Chao Peng, 2022/07/06
[PATCH v7 05/14] mm/memfd: Introduce MFD_INACCESSIBLE flag, Chao Peng, 2022/07/06
[PATCH v7 08/14] KVM: Rename mmu_notifier_*, Chao Peng, 2022/07/06
[PATCH v7 06/14] KVM: Rename KVM_PRIVATE_MEM_SLOTS to KVM_INTERNAL_MEM_SLOTS, Chao Peng, 2022/07/06
[PATCH v7 07/14] KVM: Use gfn instead of hva for mmu_notifier_retry, Chao Peng, 2022/07/06