Skip to content

Commit

Permalink
s390/mm: use pmd_pgtable_page() helper in __gmap_segment_gaddr()
Browse files Browse the repository at this point in the history
In __gmap_segment_gaddr() pmd level page table page is being extracted
from the pmd pointer, similar to pmd_pgtable_page() implementation.  This
reduces some redundancy by directly using pmd_pgtable_page() instead,
though first making it available.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
Acked-by: Alexander Gordeev <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Heiko Carstens <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Anshuman Khandual authored and akpm00 committed Nov 30, 2022
1 parent 373dfda commit 7e25de7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions arch/s390/mm/gmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,11 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table,
static unsigned long __gmap_segment_gaddr(unsigned long *entry)
{
struct page *page;
unsigned long offset, mask;
unsigned long offset;

offset = (unsigned long) entry / sizeof(unsigned long);
offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE;
mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
page = virt_to_page((void *)((unsigned long) entry & mask));
page = pmd_pgtable_page((pmd_t *) entry);
return page->index + offset;
}

Expand Down
2 changes: 1 addition & 1 deletion include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ static inline void pgtable_pte_page_dtor(struct page *page)

#if USE_SPLIT_PMD_PTLOCKS

static struct page *pmd_pgtable_page(pmd_t *pmd)
static inline struct page *pmd_pgtable_page(pmd_t *pmd)
{
unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
return virt_to_page((void *)((unsigned long) pmd & mask));
Expand Down

0 comments on commit 7e25de7

Please sign in to comment.