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

[PATCH 8/8] x86/mm: re-arrange type check around _get_page_type()'s TLB flush


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 26 Jul 2022 18:07:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HL14tmU18Cp4BQe+e29MGYjb1FaYInGq5siSnr2Mod8=; b=e5EzArV5hs+bs9alpdeSnIT3UBGaljOZScU80EqjLPSwv6Cwgw1565vzTAyg3LszDjPswjDbcmqDdcJ02G2oLt0WrcDM8AFg9KqIJM70InhX27BXdGcXK49R6mPwOJoV4QUkGrYMhcMrFzSdYiBnmzqUZ8CeI6GqxLjgIzvG4QL0v1j2QNUMfBIWS4Gg578gUEzDcHClylGeLAKiArf1fE/EN7y4uvLWvLQLgd04NM64FZ1ThOanwE/SyIivw4HKPXS8eT6tvBkiZSwgJ4scGP/LSobkcB1aDzmIeOJfG8r4Iwj/bSirOlKAUZPEFM27+7f5pdniqyYFFYgyhER6xQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ktA7nN6zAq3AbE/KoNY5DyGI/cFOI3j9W01sKmpKyZnnbmK3MsBWetaWpAY3JcSfpoRRBAbuxK0AOhLeAPgbsYG8VcgABGzpHA75+Afb4dYZ9VpZP794ichuy3vTEJ61ETHFffW6Yt7qLxpPG5CzLz2EUU1mnjyvziEMfXYQKdvvk5bBNFpA1NZezgHAhHfjY1UIKtzLfiH7hEgFJaI1BSrKlWRoDHr0CFsZS/hEG5i/d8OzS3n/VQ5kf3e0XtopLVRjU3yaP28YIllUK7EdH6ZC3cGe+bJiTI1cH4RREJ9Yj0FWVB2h6HUZDY06NL9Soxz87lAsr7Zc5pmWwUO6dA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Tue, 26 Jul 2022 16:07:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Checks dependent on only d and x can be pulled out, thus allowing to
skip the flush mask calculation.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3020,7 +3020,10 @@ static int _get_page_type(struct page_in
         if ( d && shadow_mode_enabled(d) )
             shadow_prepare_page_type_change(d, page);
 
-        if ( (x ^ type) & PGT_type_mask )
+        if ( ((x ^ type) & PGT_type_mask) &&
+             /* Shadow mode: track only writable pages. */
+             (!shadow_mode_enabled(d) ||
+              ((x & PGT_type_mask) == PGT_writable_page)) )
         {
             /*
              * On type change we check to flush stale TLB entries. It is
@@ -3035,10 +3038,7 @@ static int _get_page_type(struct page_in
             /* Don't flush if the timestamp is old enough */
             tlbflush_filter(mask, page->tlbflush_timestamp);
 
-            if ( unlikely(!cpumask_empty(mask)) &&
-                 /* Shadow mode: track only writable pages. */
-                 (!shadow_mode_enabled(d) ||
-                  ((x & PGT_type_mask) == PGT_writable_page)) )
+            if ( unlikely(!cpumask_empty(mask)) )
             {
                 perfc_incr(need_flush_tlb_flush);
                 /*




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.