From: Mike Kravetz <mike.kravetz@oracle.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
David Hildenbrand <david@redhat.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Naoya Horiguchi <naoya.horiguchi@linux.dev>,
Michael Ellerman <mpe@ellerman.id.au>,
Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] hugetlb: simplify hugetlb handling in follow_page_mask
Date: Tue, 06 Sep 2022 17:13:24 +0000 [thread overview]
Message-ID: <Yxd/tE4EnIqhfd9s@monkey> (raw)
In-Reply-To: <3a65e455-ce68-30e2-6e1b-fb8a1917b40d@csgroup.eu>
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
WARNING: multiple messages have this Message-ID (diff)
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>,
"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
David Hildenbrand <david@redhat.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Muchun Song <songmuchun@bytedance.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2] hugetlb: simplify hugetlb handling in follow_page_mask
Date: Tue, 6 Sep 2022 10:13:24 -0700 [thread overview]
Message-ID: <Yxd/tE4EnIqhfd9s@monkey> (raw)
In-Reply-To: <3a65e455-ce68-30e2-6e1b-fb8a1917b40d@csgroup.eu>
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
WARNING: multiple messages have this Message-ID (diff)
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
David Hildenbrand <david@redhat.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Naoya Horiguchi <naoya.horiguchi@linux.dev>,
Michael Ellerman <mpe@ellerman.id.au>,
Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] hugetlb: simplify hugetlb handling in follow_page_mask
Date: Tue, 6 Sep 2022 10:13:24 -0700 [thread overview]
Message-ID: <Yxd/tE4EnIqhfd9s@monkey> (raw)
In-Reply-To: <3a65e455-ce68-30e2-6e1b-fb8a1917b40d@csgroup.eu>
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
next prev parent reply other threads:[~2022-09-06 17:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 19:03 [PATCH v2] hugetlb: simplify hugetlb handling in follow_page_mask Mike Kravetz
2022-09-02 19:03 ` Mike Kravetz
2022-09-02 19:03 ` Mike Kravetz
2022-09-05 6:34 ` Christophe Leroy
2022-09-05 6:34 ` Christophe Leroy
2022-09-05 6:34 ` Christophe Leroy
2022-09-06 17:13 ` Mike Kravetz [this message]
2022-09-06 17:13 ` Mike Kravetz
2022-09-06 17:13 ` Mike Kravetz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yxd/tE4EnIqhfd9s@monkey \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=christophe.leroy@csgroup.eu \
--cc=david@redhat.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=naoya.horiguchi@linux.dev \
--cc=songmuchun@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.