Skip to content

Commit 251a0ff

Browse files
arjunroytorvalds
authored andcommitted
mm: bring sparc pte_index() semantics inline with other platforms
pte_index() on platforms other than sparc return a numerical index. On sparc, it returns a pte_t*. This presents an issue for vm_insert_pages(), which relies on pte_index() to find the offset for a pte within a pmd, for batched inserts. This patch: 1. Modifies pte_index() for sparc to return a numerical index, like other platforms, 2. Defines pte_entry() for sparc which returns a pte_t* (as pte_index() used to), 3. Converts existing sparc callers for pte_index() to use pte_entry(). [[email protected]: remove pte_entry and just directly modified pte_offset_kernel instead] Signed-off-by: Arjun Roy <[email protected]> Signed-off-by: Stephen Rothwell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Mike Rapoport <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Soheil Hassas Yeganeh <[email protected]> Cc: David Miller <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Arjun Roy <[email protected]> Cc: Jason Gunthorpe <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8efd6f5 commit 251a0ff

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/sparc/include/asm/pgtable_64.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,11 @@ static inline unsigned long pud_pfn(pud_t pud)
907907
(((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)))
908908

909909
/* Find an entry in the third-level page table.. */
910-
#define pte_index(dir, address) \
911-
((pte_t *) __pmd_page(*(dir)) + \
912-
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
913-
#define pte_offset_kernel pte_index
914-
#define pte_offset_map pte_index
910+
#define pte_index(address) \
911+
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
912+
#define pte_offset_kernel(dir, address) \
913+
((pte_t *) __pmd_page(*(dir)) + pte_index(address))
914+
#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
915915
#define pte_unmap(pte) do { } while (0)
916916

917917
/* We cannot include <linux/mm_types.h> at this point yet: */

0 commit comments

Comments
 (0)