Re: [RFC PATCH 1/5] hugetlb: add hugetlb helpers for soft dirty support

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

 



On Wed, Feb 10, 2021 at 04:03:18PM -0800, Mike Kravetz wrote:
> Add interfaces to set and clear soft dirty in hugetlb ptes.  Make
> hugetlb interfaces needed for /proc clear_refs available outside
> hugetlb.c.
> 
> arch/s390 has it's own version of most routines in asm-generic/hugetlb.h,
> so add new routines there as well.
> 
> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
> ---
>  arch/s390/include/asm/hugetlb.h | 30 ++++++++++++++++++++++++++++++
>  include/asm-generic/hugetlb.h   | 30 ++++++++++++++++++++++++++++++
>  include/linux/hugetlb.h         |  1 +
>  mm/hugetlb.c                    | 10 +---------
>  4 files changed, 62 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
> index 60f9241e5e4a..b7d26248fb1c 100644
> --- a/arch/s390/include/asm/hugetlb.h
> +++ b/arch/s390/include/asm/hugetlb.h
> @@ -105,6 +105,11 @@ static inline pte_t huge_pte_mkdirty(pte_t pte)
>  	return pte_mkdirty(pte);
>  }
>  
> +static inline pte_t huge_pte_mkyoung(pte_t pte)
> +{
> +	return pte_mkyoung(pte);
> +}
> +
>  static inline pte_t huge_pte_wrprotect(pte_t pte)
>  {
>  	return pte_wrprotect(pte);
> @@ -115,9 +120,34 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
>  	return pte_modify(pte, newprot);
>  }
>  
> +static inline bool huge_pte_soft_dirty(pte_t pte)
> +{
> +	return pte_soft_dirty(pte);
> +}
> +
> +static inline pte_t huge_pte_clear_soft_dirty(pte_t pte)
> +{
> +	return pte_clear_soft_dirty(pte);
> +}
> +
> +static inline pte_t huge_pte_swp_clear_soft_dirty(pte_t pte)
> +{
> +	return pte_swp_clear_soft_dirty(pte);
> +}
> +

Indeed asm/hugetlb.h of s390 didn't include asm-generic/hugetlb.h as what was
normally done by asm/hugetlb.h of other archs.  Do you know why it's special?
E.g. huge_pte_wrprotect() of s390 version is actually the same of the default
version.

When I looked at the huge_pte_wrprotect() I also see that there seems to have
no real user of __HAVE_ARCH_HUGE_PTE_WRPROTECT.  Not sure whether it can be
dropped.  My gut feeling is that s390 should also include asm-generic/hugetlb.h
but only redefine the helper only if necessary, since I see no point defining
the same helper multiple times.

>  static inline bool gigantic_page_runtime_supported(void)
>  {
>  	return true;
>  }
>  
> +#if !defined(__HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE) && !defined(MODULE)
> +#include <asm/tlbflush.h>
> +
> +static inline void flush_hugetlb_tlb_range(struct vm_area_struct *vma,
> +					unsigned long start, unsigned long end)
> +{
> +	flush_tlb_range(vma, start, end);
> +}
> +#endif

Similar question here, only ppc defined __HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE, so
IIUC it means s390 should simply use the default version, and it'll be great if
we don't need to redefine it here.

Thanks,

-- 
Peter Xu




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux