[ltc-interlock] [PATCH] hugetlb: Fix hot remove for PowerVM

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Wed Jul 26 14:35:42 AEST 2017


Diego Domingos <diegodo at linux.vnet.ibm.com> writes:

> PowerVM has support for 16G huge pages, so the function
> gigantic_page_supported needs to check if the running system
> is a pseries and check if there are some gigantic page
> registered. Then, we must return true - avoiding Segmentation
> Fault when hot removing memory sections within huge pages.

That is not correct. Those pages are not in zone/buddy. What
gigantic_page_supported checks is whether we can allocate pages runtime.
We scan the zones, check if we have the range that we are looking for
free for allocation, if so we do runtime allocation of those pages. This
may include page migration too. But these pages comes from buddy. We
don't do buddy allocator directly here, because the order of allocation
we are looking is more than max order.

>
> Signed-off-by: Diego Domingos <diegodo at linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/book3s/64/hugetlb.h | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h b/arch/powerpc/include/asm/book3s/64/hugetlb.h
> index 5c28bd6..49e43dd 100644
> --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h
> +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h
> @@ -1,3 +1,5 @@
> +#include <asm/machdep.h>
> +
>  #ifndef _ASM_POWERPC_BOOK3S_64_HUGETLB_H
>  #define _ASM_POWERPC_BOOK3S_64_HUGETLB_H
>  /*
> @@ -54,9 +56,19 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
>  #ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
>  static inline bool gigantic_page_supported(void)
>  {
> +        struct hstate *h;
> +
>  	if (radix_enabled())
>  		return true;
> -	return false;
> +
> +        /* PowerVM can support 16GB hugepages (requested at boot time) */
> +        if(machine_is(pseries))
> +            for_each_hstate(h) {
> +                if (hstate_get_psize(h) == MMU_PAGE_16G)
> +                    return true;
> +            }
> +        
> +        return false;
>  }
>  #endif
>
> -- 
> 1.8.3.1
>
> _______________________________________________________
> ltc-interlock mailing list <ltc-interlock at lists.linux.ibm.com>
> To unsubscribe from the list, change your list options
> or if you have forgotten your list password visit:
> https://w3-01.ibm.com/stg/linux/ltc/mailinglists/listinfo/ltc-interlock



More information about the Linuxppc-dev mailing list