[PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()

Mike Rapoport rppt at kernel.org
Wed Feb 2 18:37:41 AEDT 2022


On Wed, Feb 02, 2022 at 06:25:31AM +0000, Christophe Leroy wrote:
> 
> 
> Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> > On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> >> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> >> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> >> This updates generic fallback stub for arch_make_huge_pte() and available
> >> platforms definitions. This makes huge pte creation much cleaner and easier
> >> to follow.
> > 
> > Won't it break architectures that don't define arch_make_huge_pte()?
> 
> It shouldn't, see below

Right, overlooked that.
 
> >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> >> index d1897a69c540..52c462390aee 100644
> >> --- a/include/linux/hugetlb.h
> >> +++ b/include/linux/hugetlb.h
> >> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
> >>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
> >>   				       vm_flags_t flags)
> >>   {
> >> -	return entry;
> >> +	return pte_mkhuge(entry);
> >>   }
> >>   #endif
> >>   

-- 
Sincerely yours,
Mike.


More information about the Linuxppc-dev mailing list