Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1223322

[PATCH] ARM: mm: avoid unneeded page protection fault for memory range with (VM_PFNMAP|VM_PFNWRITE)

Path csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Wang YanQing <udknight@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] ARM: mm: avoid unneeded page protection fault for memory range with (VM_PFNMAP|VM_PFNWRITE)
Date Sat, 12 Sep 2015 08:20:02 +0200
Message-ID <q7Mki-Cv-9@gated-at.bofh.it> (permalink)
X-Original-To rmk+kernel@arm.linux.org.uk
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=vbvtyUuWzq59JTu3W/N96zwi+2RRLxtSSN8jyRFPMcQ=; b=nUxYA9Ac/hb7Wzsw8OStJG4d32Wyq85aSCwCJqVlVWvl6i8vPZYIKwjXJDnevHgx+/ l8SW7GGsmh8n7mVjCCT1oLTMG4IAXnb+a/8CMUrZgkX8z7lZ9K5drTKPtK+2Te3mKnQr jRF2ck0B7vL7NgPVuVqPjmiTYp9fETuOO1xNJRTHlVoEVLz55JSsoeWeVPfbMAK9O0Vj BhqojUIs/q1gKjj03kX6wGI2o4L7f+7xIEhMt3NDcPfI6i66zhjSW4+X6/wnzyu1fEbF ZRC8ZXnjLWwplesjrCqm3Gw+2baV4ziTpti+I7lflM9/bwwM41UbCPBEGq57sgclcpXH x8kw==
X-Received by 10.66.234.138 with SMTP id ue10mr6411525pac.9.1442038336868; Fri, 11 Sep 2015 23:12:16 -0700 (PDT)
Mail-Followup-To Wang YanQing <udknight@gmail.com>, rmk+kernel@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux@arm.linux.org.uk
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.22 (2013-10-16)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 47
Organization linux.* mail to news gateway
X-Original-Cc linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux@arm.linux.org.uk
X-Original-Date Sat, 12 Sep 2015 14:04:30 +0800
X-Original-Message-ID <20150912060430.GA16768@udknight>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1223322

Show key headers only | View 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] ARM: mm: avoid unneeded page protection fault for memory  range with (VM_PFNMAP|VM_PFNWRITE) Wang YanQing <udknight@gmail.com> - 2015-09-12 08:20 +0200

csiph-web