KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
Subsystems (2)
PATCH 1/1 KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
guest_memfd folios don't care about accessed flags since the memory is unevictable and there is no storage to write back to, hence, cleanup the allocation path by not setting FGP_ACCESSED.
Signed-off-by Ackerley Tng <[email protected]>
[sean: split to separate patch]
Signed-off-by Sean Christopherson <[email protected]>
Acked-by Vlastimil Babka <[email protected]>
--- virt/kvm/guest_memfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
virt/kvm/guest_memfd.c +2 -3
@@ -140,14 +140,13 @@ static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)* Fast-path: See if folio is already present in mapping to avoid * policy_lookup. */ - folio =__filemap_get_folio (inode->i_mapping, index, -FGP_LOCK |FGP_ACCESSED ,0 ); + folio =filemap_lock_folio (inode->i_mapping, index);if (!IS_ERR (folio))return folio; policy =mpol_shared_policy_lookup (&GMEM_I (inode)->policy, index); folio =__filemap_get_folio_mpol (inode->i_mapping, index, -FGP_LOCK |FGP_ACCESSED |FGP_CREAT , +FGP_LOCK |FGP_CREAT ,mapping_gfp_mask (inode->i_mapping), policy);mpol_cond_put (policy);
Signature · 1 line
2.53.0.rc1.225.gd81095ad13-goog
Quoted 9 lines · Ackerley Tng
guest_memfdfolios don't care about accessed flags since the memory is unevictable and there is no storage to write back to, hence, cleanup the allocation path by not settingFGP_ACCESSED.Signed-off-by Ackerley Tng <[email protected]>[sean: split to separate patch]Signed-off-by Sean Christopherson <[email protected]>Acked-by Vlastimil Babka <[email protected]>---
Signature · 3 lines
Cheers David
Quoted 3 lines · Ackerley Tng
guest_memfdfolios don't care about accessed flags since the memory is unevictable and there is no storage to write back to, hence, cleanup the allocation path by not settingFGP_ACCESSED.
Applied to kvm-x86 gmem, thanks!
[1/1] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
https://github.com/kvm-x86/linux/commit/6dad5447c7bf