mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
@ 2026-01-29 17:26 Ackerley Tng
  2026-02-02  9:18 ` David Hildenbrand (arm)
  2026-03-05 17:07 ` Sean Christopherson
  0 siblings, 2 replies; 3+ messages in thread
From: Ackerley Tng @ 2026-01-29 17:26 UTC (permalink / raw)
  To: pbonzini, seanjc, kvm, linux-kernel
  Cc: david, vannapurve, Ackerley Tng, Vlastimil Babka

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 <ackerleytng@google.com>
[sean: split to separate patch]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
---
 virt/kvm/guest_memfd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
index fdaea3422c30..b3117f3359af 100644
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@ -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);
 
-- 
2.53.0.rc1.225.gd81095ad13-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
  2026-01-29 17:26 [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios Ackerley Tng
@ 2026-02-02  9:18 ` David Hildenbrand (arm)
  2026-03-05 17:07 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand (arm) @ 2026-02-02  9:18 UTC (permalink / raw)
  To: Ackerley Tng, pbonzini, seanjc, kvm, linux-kernel; +Cc: Vlastimil Babka

On 1/29/26 18:26, Ackerley Tng wrote:
> 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 <ackerleytng@google.com>
> [sean: split to separate patch]
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---

Acked-by: David Hildenbrand (arm) <david@kernel.org>

-- 
Cheers

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
  2026-01-29 17:26 [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios Ackerley Tng
  2026-02-02  9:18 ` David Hildenbrand (arm)
@ 2026-03-05 17:07 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2026-03-05 17:07 UTC (permalink / raw)
  To: Sean Christopherson, pbonzini, kvm, linux-kernel, Ackerley Tng
  Cc: david, vannapurve, Vlastimil Babka

On Thu, 29 Jan 2026 09:26:46 -0800, Ackerley Tng wrote:
> 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.

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

--
https://github.com/kvm-x86/linux/tree/next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-05 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-29 17:26 [PATCH] KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios Ackerley Tng
2026-02-02  9:18 ` David Hildenbrand (arm)
2026-03-05 17:07 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®