linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, Peter Zijlstra <peterz@infradead.org>,
	Bin Yang <bin.yang@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Mark Gross <mark.gross@intel.com>
Subject: [patch V2 06/10] x86/mm/cpa: Avoid static protection checks on unmap
Date: Fri, 14 Sep 2018 15:09:23 +0200	[thread overview]
Message-ID: <20180914131302.110697717@linutronix.de> (raw)
In-Reply-To: 20180914130917.155416208@linutronix.de

[-- Attachment #1: x86-mm-cpa--Avoid-static-protection-checks-on-unmap.patch --]
[-- Type: text/plain, Size: 1326 bytes --]

If the new pgprot has the PRESENT bit cleared, then conflicts vs. RW/NX are
completely irrelevant.

Before:

 1G pages checked:                    2
 1G pages sameprot:                   0
 1G pages preserved:                  0
 2M pages checked:                  540
 2M pages sameprot:                 466
 2M pages preserved:                 47
 4K pages checked:               800770
 4K pages set-checked:             7668

After:

 1G pages checked:                    2
 1G pages sameprot:                   0
 1G pages preserved:                  0
 2M pages checked:                  540
 2M pages sameprot:                 466
 2M pages preserved:                 47
 4K pages checked:               800709
 4K pages set-checked:             7668

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/mm/pageattr.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -522,6 +522,13 @@ static inline pgprot_t static_protection
 	pgprotval_t forbidden, res;
 	unsigned long end;
 
+	/*
+	 * There is no point in checking RW/NX conflicts when the requested
+	 * mapping is setting the page !PRESENT.
+	 */
+	if (!(pgprot_val(prot) & _PAGE_PRESENT))
+		return prot;
+
 	/* Operate on the virtual address */
 	end = start + npg * PAGE_SIZE - 1;
 



  parent reply	other threads:[~2018-09-14 13:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 13:09 [patch V2 00/10] x86/mm/cpa: Improve large page preservation handling Thomas Gleixner
2018-09-14 13:09 ` [patch V2 01/10] x86/mm/cpa: Split, rename and clean up try_preserve_large_page() Thomas Gleixner
2018-09-14 13:09 ` [patch V2 02/10] x86/mm/cpa: Rework static_protections() Thomas Gleixner
2018-09-14 13:09 ` [patch V2 03/10] x86/mm/cpa: Allow range check for static protections Thomas Gleixner
2018-09-14 13:09 ` [patch V2 04/10] x86/mm/cpa: Add debug mechanism Thomas Gleixner
2018-09-14 23:22   ` kbuild test robot
2018-09-15  6:58   ` kbuild test robot
2018-09-15 13:06   ` [patch V3 " Thomas Gleixner
2018-09-14 13:09 ` [patch V2 05/10] x86/mm/cpa: Add large page preservation statistics Thomas Gleixner
2018-09-14 13:09 ` Thomas Gleixner [this message]
2018-09-14 13:09 ` [patch V2 07/10] x86/mm/cpa: Add sanity check for existing mappings Thomas Gleixner
2018-09-17  0:31   ` [LKP] [x86/mm/cpa] c77d419f92: WARNING:at_arch/x86/mm/pageattr.c:#__change_page_attr_set_clr kernel test robot
2018-09-17 11:05     ` Thomas Gleixner
2018-09-14 13:09 ` [patch V2 08/10] x86/mm/cpa: Optimize same protection check Thomas Gleixner
2018-09-14 13:09 ` [patch V2 09/10] x86/mm/cpa: Do the range check early Thomas Gleixner
2018-09-14 13:09 ` [patch V2 10/10] x86/mm/cpa: Avoid the 4k pages check completely Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180914131302.110697717@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bin.yang@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.gross@intel.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).