All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
@ 2023-03-15 17:16 Peter Xu
  2023-03-15 21:06 ` Yang Shi
  2023-03-16 14:57 ` David Hildenbrand
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Xu @ 2023-03-15 17:16 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Andrew Morton, peterx, Aneesh Kumar K . V, Yang Shi

TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX.  It's set when
has_transparent_hugepage() returns false, checked in hugepage_vma_check()
and will disable THP completely if false.  Rename it to reflect its real
purpose.

Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Yang Shi <shy828301@gmail.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/linux/huge_mm.h | 2 +-
 mm/huge_memory.c        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 70bd867eba94..9a3a3af2dd80 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
 }
 
 enum transparent_hugepage_flag {
-	TRANSPARENT_HUGEPAGE_NEVER_DAX,
+	TRANSPARENT_HUGEPAGE_UNSUPPORTED,
 	TRANSPARENT_HUGEPAGE_FLAG,
 	TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
 	TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index b0ab247939e0..913e7dc32869 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
 	/*
 	 * If the hardware/firmware marked hugepage support disabled.
 	 */
-	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX))
+	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED))
 		return false;
 
 	/* khugepaged doesn't collapse DAX vma, but page fault is fine. */
@@ -464,7 +464,7 @@ static int __init hugepage_init(void)
 		 * Hardware doesn't support hugepages, hence disable
 		 * DAX PMD support.
 		 */
-		transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_NEVER_DAX;
+		transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED;
 		return -EINVAL;
 	}
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
  2023-03-15 17:16 [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED Peter Xu
@ 2023-03-15 21:06 ` Yang Shi
  2023-03-16 14:57 ` David Hildenbrand
  1 sibling, 0 replies; 5+ messages in thread
From: Yang Shi @ 2023-03-15 21:06 UTC (permalink / raw)
  To: Peter Xu; +Cc: linux-kernel, linux-mm, Andrew Morton, Aneesh Kumar K . V

On Wed, Mar 15, 2023 at 10:16 AM Peter Xu <peterx@redhat.com> wrote:
>
> TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX.  It's set when
> has_transparent_hugepage() returns false, checked in hugepage_vma_check()
> and will disable THP completely if false.  Rename it to reflect its real
> purpose.

Makes sense to me. Reviewed-by: Yang Shi <shy828301@gmail.com>

>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Yang Shi <shy828301@gmail.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/linux/huge_mm.h | 2 +-
>  mm/huge_memory.c        | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index 70bd867eba94..9a3a3af2dd80 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
>  }
>
>  enum transparent_hugepage_flag {
> -       TRANSPARENT_HUGEPAGE_NEVER_DAX,
> +       TRANSPARENT_HUGEPAGE_UNSUPPORTED,
>         TRANSPARENT_HUGEPAGE_FLAG,
>         TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
>         TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index b0ab247939e0..913e7dc32869 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
>         /*
>          * If the hardware/firmware marked hugepage support disabled.
>          */
> -       if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX))
> +       if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED))
>                 return false;
>
>         /* khugepaged doesn't collapse DAX vma, but page fault is fine. */
> @@ -464,7 +464,7 @@ static int __init hugepage_init(void)
>                  * Hardware doesn't support hugepages, hence disable
>                  * DAX PMD support.
>                  */
> -               transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_NEVER_DAX;
> +               transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED;
>                 return -EINVAL;
>         }
>
> --
> 2.39.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
  2023-03-15 17:16 [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED Peter Xu
  2023-03-15 21:06 ` Yang Shi
@ 2023-03-16 14:57 ` David Hildenbrand
  2023-03-16 15:18   ` Peter Xu
  1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2023-03-16 14:57 UTC (permalink / raw)
  To: Peter Xu, linux-kernel, linux-mm
  Cc: Andrew Morton, Aneesh Kumar K . V, Yang Shi

On 15.03.23 18:16, Peter Xu wrote:
> TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX.  It's set when
> has_transparent_hugepage() returns false, checked in hugepage_vma_check()
> and will disable THP completely if false.  Rename it to reflect its real
> purpose.
> 
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Yang Shi <shy828301@gmail.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   include/linux/huge_mm.h | 2 +-
>   mm/huge_memory.c        | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index 70bd867eba94..9a3a3af2dd80 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
>   }
>   
>   enum transparent_hugepage_flag {
> -	TRANSPARENT_HUGEPAGE_NEVER_DAX,
> +	TRANSPARENT_HUGEPAGE_UNSUPPORTED,
>   	TRANSPARENT_HUGEPAGE_FLAG,
>   	TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
>   	TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index b0ab247939e0..913e7dc32869 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
>   	/*
>   	 * If the hardware/firmware marked hugepage support disabled.
>   	 */
> -	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX))
> +	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED))
>   		return false;
>   
>   	/* khugepaged doesn't collapse DAX vma, but page fault is fine. */
> @@ -464,7 +464,7 @@ static int __init hugepage_init(void)
>   		 * Hardware doesn't support hugepages, hence disable
>   		 * DAX PMD support.


We should also fixup that comment then, no?

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
  2023-03-16 14:57 ` David Hildenbrand
@ 2023-03-16 15:18   ` Peter Xu
  2023-03-16 15:37     ` David Hildenbrand
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Xu @ 2023-03-16 15:18 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, Andrew Morton, Aneesh Kumar K . V, Yang Shi

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On Thu, Mar 16, 2023 at 03:57:12PM +0100, David Hildenbrand wrote:
> On 15.03.23 18:16, Peter Xu wrote:
> > TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX.  It's set when
> > has_transparent_hugepage() returns false, checked in hugepage_vma_check()
> > and will disable THP completely if false.  Rename it to reflect its real
> > purpose.
> > 
> > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> > Cc: Yang Shi <shy828301@gmail.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >   include/linux/huge_mm.h | 2 +-
> >   mm/huge_memory.c        | 4 ++--
> >   2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> > index 70bd867eba94..9a3a3af2dd80 100644
> > --- a/include/linux/huge_mm.h
> > +++ b/include/linux/huge_mm.h
> > @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
> >   }
> >   enum transparent_hugepage_flag {
> > -	TRANSPARENT_HUGEPAGE_NEVER_DAX,
> > +	TRANSPARENT_HUGEPAGE_UNSUPPORTED,
> >   	TRANSPARENT_HUGEPAGE_FLAG,
> >   	TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
> >   	TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index b0ab247939e0..913e7dc32869 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
> >   	/*
> >   	 * If the hardware/firmware marked hugepage support disabled.
> >   	 */
> > -	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX))
> > +	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED))
> >   		return false;
> >   	/* khugepaged doesn't collapse DAX vma, but page fault is fine. */
> > @@ -464,7 +464,7 @@ static int __init hugepage_init(void)
> >   		 * Hardware doesn't support hugepages, hence disable
> >   		 * DAX PMD support.
> 
> 
> We should also fixup that comment then, no?

Yes, I'd drop the comment since the code explains itself.  One fixup
attached.  Thanks.

-- 
Peter Xu

[-- Attachment #2: 0001-fixup-mm-thp-rename-TRANSPARENT_HUGEPAGE_NEVER_DAX-t.patch --]
[-- Type: text/plain, Size: 804 bytes --]

From 0d01260fedfd9d99c1eeac10f9bddd52477823bd Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Thu, 16 Mar 2023 11:08:47 -0400
Subject: [PATCH] fixup! mm/thp: rename TRANSPARENT_HUGEPAGE_NEVER_DAX to
 _UNSUPPORTED

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 mm/huge_memory.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 2bb16cf4cafa..81a5689806af 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -460,10 +460,6 @@ static int __init hugepage_init(void)
 	struct kobject *hugepage_kobj;
 
 	if (!has_transparent_hugepage()) {
-		/*
-		 * Hardware doesn't support hugepages, hence disable
-		 * DAX PMD support.
-		 */
 		transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED;
 		return -EINVAL;
 	}
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
  2023-03-16 15:18   ` Peter Xu
@ 2023-03-16 15:37     ` David Hildenbrand
  0 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2023-03-16 15:37 UTC (permalink / raw)
  To: Peter Xu
  Cc: linux-kernel, linux-mm, Andrew Morton, Aneesh Kumar K . V, Yang Shi

On 16.03.23 16:18, Peter Xu wrote:
> On Thu, Mar 16, 2023 at 03:57:12PM +0100, David Hildenbrand wrote:
>> On 15.03.23 18:16, Peter Xu wrote:
>>> TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX.  It's set when
>>> has_transparent_hugepage() returns false, checked in hugepage_vma_check()
>>> and will disable THP completely if false.  Rename it to reflect its real
>>> purpose.
>>>
>>> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>> Cc: Yang Shi <shy828301@gmail.com>
>>> Signed-off-by: Peter Xu <peterx@redhat.com>
>>> ---
>>>    include/linux/huge_mm.h | 2 +-
>>>    mm/huge_memory.c        | 4 ++--
>>>    2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
>>> index 70bd867eba94..9a3a3af2dd80 100644
>>> --- a/include/linux/huge_mm.h
>>> +++ b/include/linux/huge_mm.h
>>> @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
>>>    }
>>>    enum transparent_hugepage_flag {
>>> -	TRANSPARENT_HUGEPAGE_NEVER_DAX,
>>> +	TRANSPARENT_HUGEPAGE_UNSUPPORTED,
>>>    	TRANSPARENT_HUGEPAGE_FLAG,
>>>    	TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
>>>    	TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
>>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>>> index b0ab247939e0..913e7dc32869 100644
>>> --- a/mm/huge_memory.c
>>> +++ b/mm/huge_memory.c
>>> @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
>>>    	/*
>>>    	 * If the hardware/firmware marked hugepage support disabled.
>>>    	 */
>>> -	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX))
>>> +	if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED))
>>>    		return false;
>>>    	/* khugepaged doesn't collapse DAX vma, but page fault is fine. */
>>> @@ -464,7 +464,7 @@ static int __init hugepage_init(void)
>>>    		 * Hardware doesn't support hugepages, hence disable
>>>    		 * DAX PMD support.
>>
>>
>> We should also fixup that comment then, no?
> 
> Yes, I'd drop the comment since the code explains itself.  One fixup
> attached.  Thanks.

LGTM

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-16 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 17:16 [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED Peter Xu
2023-03-15 21:06 ` Yang Shi
2023-03-16 14:57 ` David Hildenbrand
2023-03-16 15:18   ` Peter Xu
2023-03-16 15:37     ` David Hildenbrand

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.