summary refs log tree commit diff
path: root/include/asm-generic/pgtable.h
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2020-05-27 10:25:19 +0800
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-05-27 13:06:40 +0200
commit44bf431b47b4298d8aaba7b02d0ad29fc609a03c (patch)
treeabdc24c53f8a9c2a7c283e799a44c29db145d780 /include/asm-generic/pgtable.h
parent7df676974359f927056b882e10a5b24d2033169b (diff)
downloadlinux-44bf431b47b4298d8aaba7b02d0ad29fc609a03c.tar.gz
mm/memory.c: Add memory read privilege on page fault handling
Here add pte_sw_mkyoung function to make page readable on MIPS
platform during page fault handling. This patch improves page
fault latency about 10% on my MIPS machine with lmbench
lat_pagefault case.

It is noop function on other arches, there is no negative
influence on those architectures.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'include/asm-generic/pgtable.h')
-rw-r--r--include/asm-generic/pgtable.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index fa5c73ff8226..b5278ec627db 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -244,6 +244,22 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 }
 #endif
 
+/*
+ * On some architectures hardware does not set page access bit when accessing
+ * memory page, it is responsibilty of software setting this bit. It brings
+ * out extra page fault penalty to track page access bit. For optimization page
+ * access bit can be set during all page fault flow on these arches.
+ * To be differentiate with macro pte_mkyoung, this macro is used on platforms
+ * where software maintains page access bit.
+ */
+#ifndef pte_sw_mkyoung
+static inline pte_t pte_sw_mkyoung(pte_t pte)
+{
+	return pte;
+}
+#define pte_sw_mkyoung	pte_sw_mkyoung
+#endif
+
 #ifndef pte_savedwrite
 #define pte_savedwrite pte_write
 #endif