All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: limit deferred TLB flushing to PV owned pages
@ 2026-09-09  7:24 Roger Pau Monne
  2026-09-09  9:21 ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Roger Pau Monne @ 2026-09-09  7:24 UTC (permalink / raw)
  To: xen-devel
  Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
	Jan Beulich, Julien Grall, Stefano Stabellini

The current logic on x86 will mark all domain owned pages as needed a TLB
flush before being re-used.  However such TLB flushing is only strictly
needed for PV domain owned pages, as those can keep a reference to the page
in the TLB after it has been freed.

Limit the requirement of a flush to pages that are owned by PV domains.

Signed-off-by: Roger Pau Monné <roger@xenproject.org>
---
 xen/common/page_alloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 62ac89b824de..be202f0b8d1e 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1501,6 +1501,7 @@ bool scrub_free_pages(void)
 
 static bool mark_page_free(struct page_info *pg, mfn_t mfn)
 {
+    const struct domain *owner = page_get_owner(pg);
     bool pg_offlined = false;
 
     ASSERT(mfn_x(mfn) == mfn_x(page_to_mfn(pg)));
@@ -1539,7 +1540,7 @@ static bool mark_page_free(struct page_info *pg, mfn_t mfn)
     }
 
     /* If a page has no owner it will need no safety TLB flush. */
-    pg->u.free.need_tlbflush = (page_get_owner(pg) != NULL);
+    pg->u.free.need_tlbflush = owner && is_pv_domain(owner);
     if ( pg->u.free.need_tlbflush )
         page_set_tlbflush_timestamp(pg);
 
-- 
2.55.0



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

end of thread, other threads:[~2026-09-09 13:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  7:24 [PATCH] x86/mm: limit deferred TLB flushing to PV owned pages Roger Pau Monne
2026-09-09  9:21 ` Jan Beulich
2026-09-09  9:58   ` Andrew Cooper
2026-09-09 13:09   ` Roger Pau Monné
2026-09-09 13:26     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.