Re: [PATCH] s390/mm: Use pmd_pgtable_page() helper in __gmap_segment_gaddr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 25, 2022 at 09:15:02AM +0530, Anshuman Khandual wrote:

Hi Anshuman,

> 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.

[...]

> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index 02d15c8dc92e..8947451ae021 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -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;
>  }

Looks okay to me.

> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index e9e387caffac..5ead9e997510 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2403,7 +2403,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));

This chunk does not appear to belong to this patch.

Thanks!



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux