lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] hugetlb: simplify hugetlb handling in follow_page_mask
On 09/05/22 06:34, Christophe Leroy wrote:
>
>
> Le 02/09/2022 à 21:03, Mike Kravetz a écrit :
> > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> > index fe4944f89d34..275e554dd365 100644
> > --- a/include/linux/hugetlb.h
> > +++ b/include/linux/hugetlb.h
> > @@ -264,6 +255,13 @@ static inline void adjust_range_if_pmd_sharing_possible(
> > {
> > }
> >
> > +static inline struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma,
> > + unsigned long address, unsigned int flags)
> > +{
> > + WARN_ON_ONCE(1); /* should never be called if !CONFIG_HUGETLB_PAGE*/
> > + return ERR_PTR(-EINVAL);
>
> This function is called only when is_vm_hugetlb_page() is true.
>
> When !CONFIG_HUGETLB_PAGE is_vm_hugetlb_page() always returns false, so
> the call to hugetlb_follow_page_mask() should never be compiled in.
>
> Use BUILD_BUG() to catch it at buildtime.
>

Yes. My bad as David suggested this previously.
How about we just leave out the function in the !CONFIG_HUGETLB_PAGE case?
We will get build errors without the need for a BUILD_BUG().

> > +}
> > +
> > static inline long follow_hugetlb_page(struct mm_struct *mm,
> > struct vm_area_struct *vma, struct page **pages,
> > struct vm_area_struct **vmas, unsigned long *position,

--
Mike Kravetz

\
 
 \ /
  Last update: 2022-09-06 19:25    [W:0.056 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site