linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wang YanQing <udknight@gmail.com>
To: rmk+kernel@arm.linux.org.uk
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux@arm.linux.org.uk
Subject: [PATCH] ARM: mm: avoid unneeded page protection fault for memory range with (VM_PFNMAP|VM_PFNWRITE)
Date: Sat, 12 Sep 2015 14:04:30 +0800	[thread overview]
Message-ID: <20150912060430.GA16768@udknight> (raw)

Add L_PTE_DIRTY to PTEs for memory range with (VM_PFNMAP|VM_PFNWRITE),
then we could avoid unneeded page protection fault in write access
first time due to L_PTE_RDONLY.

There are no valid struct pages behind VM_PFNMAP range, so it make no
sense to set L_PTE_DIRTY in page fault handler.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 arch/arm/include/asm/mman.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 arch/arm/include/asm/mman.h

diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h
new file mode 100644
index 0000000..f59bbf3
--- /dev/null
+++ b/arch/arm/include/asm/mman.h
@@ -0,0 +1,21 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef __ASM_ARM_MMAN_H
+#define __ASM_ARM_MMAN_H
+
+#include <uapi/asm/mman.h>
+
+static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
+{
+	if ((vm_flags & (VM_PFNMAP|VM_WRITE)) == (VM_PFNMAP|VM_WRITE))
+		return __pgprot(L_PTE_DIRTY);
+	else
+		return __pgprot(0);
+}
+#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
+
+#endif	/* __ASM_ARM_MMAN_H */
-- 
1.8.5.6.2.g3d8a54e.dirty

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2015-09-12  6:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150912060430.GA16768@udknight \
    --to=udknight@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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