[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-0005d20b2ff1e501e186b3b3bc587085ac305fdc@git.kernel.org>
Date: Sat, 18 Mar 2017 02:50:43 -0700
From: "tip-bot for Kirill A. Shutemov" <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: steve.capper@...aro.org, aneesh.kumar@...ux.vnet.ibm.com,
dann.frazier@...onical.com, torvalds@...ux-foundation.org,
mingo@...nel.org, bp@...en8.de, peterz@...radead.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
riel@...hat.com, kirill.shutemov@...ux.intel.com,
dave.hansen@...el.com, hpa@...or.com, catalin.marinas@....com,
tglx@...utronix.de
Subject: [tip:x86/mm] mm/gup: Move page table entry dereference into helper
function
Commit-ID: 0005d20b2ff1e501e186b3b3bc587085ac305fdc
Gitweb: http://git.kernel.org/tip/0005d20b2ff1e501e186b3b3bc587085ac305fdc
Author: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
AuthorDate: Thu, 16 Mar 2017 18:26:51 +0300
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Sat, 18 Mar 2017 09:48:02 +0100
mm/gup: Move page table entry dereference into helper function
This is a preparation patch for the transition of x86 to the generic GUP_fast()
implementation.
On x86 PAE, page table entry is larger than sizeof(long) and we would
need to provide a helper that can read the entry atomically.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Aneesh Kumar K . V <aneesh.kumar@...ux.vnet.ibm.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Dann Frazier <dann.frazier@...onical.com>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Rik van Riel <riel@...hat.com>
Cc: Steve Capper <steve.capper@...aro.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-arch@...r.kernel.org
Cc: linux-mm@...ck.org
Link: http://lkml.kernel.org/r/20170316152655.37789-4-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
mm/gup.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index a62a778c..e83db38 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1189,6 +1189,17 @@ struct page *get_dump_page(unsigned long addr)
*/
#ifdef CONFIG_HAVE_GENERIC_RCU_GUP
+#ifndef gup_get_pte
+/*
+ * We assume that the PTE can be read atomically. If this is not the case for
+ * your architecture, please provide the helper.
+ */
+static inline pte_t gup_get_pte(pte_t *ptep)
+{
+ return READ_ONCE(*ptep);
+}
+#endif
+
#ifdef __HAVE_ARCH_PTE_SPECIAL
static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
int write, struct page **pages, int *nr)
@@ -1198,14 +1209,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
ptem = ptep = pte_offset_map(&pmd, addr);
do {
- /*
- * In the line below we are assuming that the pte can be read
- * atomically. If this is not the case for your architecture,
- * please wrap this in a helper function!
- *
- * for an example see gup_get_pte in arch/x86/mm/gup.c
- */
- pte_t pte = READ_ONCE(*ptep);
+ pte_t pte = gup_get_pte(ptep);
struct page *head, *page;
/*
Powered by blists - more mailing lists