linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
@ 2025-08-21 15:00 Usama Arif
  2025-08-21 15:26 ` Zi Yan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Usama Arif @ 2025-08-21 15:00 UTC (permalink / raw)
  To: Andrew Morton, david, lorenzo.stoakes, linux-mm
  Cc: ziy, baolin.wang, Liam.Howlett, npache, ryan.roberts, dev.jain,
	baohua, kernel-team, Usama Arif

Using forced_collapse directly is clearer and enforce_sysfs is not
really needed.

Signed-off-by: Usama Arif <usamaarif642@gmail.com>
---
This was agreed upon in [1]
[1] https://lore.kernel.org/all/cd99f0f2-260d-4494-bbf6-99daec3e0683@gmail.com/
---
 mm/huge_memory.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 6fd714bd04844..5220dbc9fcb31 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -105,7 +105,6 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
 	const bool smaps = type == TVA_SMAPS;
 	const bool in_pf = type == TVA_PAGEFAULT;
 	const bool forced_collapse = type == TVA_FORCED_COLLAPSE;
-	const bool enforce_sysfs = !forced_collapse;
 	unsigned long supported_orders;
 
 	/* Check the intersection of requested and supported orders. */
@@ -168,14 +167,14 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
 	if (!in_pf && shmem_file(vma->vm_file))
 		return orders & shmem_allowable_huge_orders(file_inode(vma->vm_file),
 						   vma, vma->vm_pgoff, 0,
-						   !enforce_sysfs);
+						   forced_collapse);
 
 	if (!vma_is_anonymous(vma)) {
 		/*
-		 * Enforce sysfs THP requirements as necessary. Anonymous vmas
+		 * Enforce THP collapse requirements as necessary. Anonymous vmas
 		 * were already handled in thp_vma_allowable_orders().
 		 */
-		if (enforce_sysfs &&
+		if (!forced_collapse &&
 		    (!hugepage_global_enabled() || (!(vm_flags & VM_HUGEPAGE) &&
 						    !hugepage_global_always())))
 			return 0;
-- 
2.47.3



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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
@ 2025-08-21 15:26 ` Zi Yan
  2025-08-21 15:33 ` Lorenzo Stoakes
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Zi Yan @ 2025-08-21 15:26 UTC (permalink / raw)
  To: Usama Arif
  Cc: Andrew Morton, david, lorenzo.stoakes, linux-mm, baolin.wang,
	Liam.Howlett, npache, ryan.roberts, dev.jain, baohua, kernel-team

On 21 Aug 2025, at 11:00, Usama Arif wrote:

> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.
>
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> ---
> This was agreed upon in [1]
> [1] https://lore.kernel.org/all/cd99f0f2-260d-4494-bbf6-99daec3e0683@gmail.com/
> ---
>  mm/huge_memory.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>

LGTM. Acked-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi


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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
  2025-08-21 15:26 ` Zi Yan
@ 2025-08-21 15:33 ` Lorenzo Stoakes
  2025-08-21 15:35 ` Dev Jain
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Stoakes @ 2025-08-21 15:33 UTC (permalink / raw)
  To: Usama Arif
  Cc: Andrew Morton, david, linux-mm, ziy, baolin.wang, Liam.Howlett,
	npache, ryan.roberts, dev.jain, baohua, kernel-team

On Thu, Aug 21, 2025 at 04:00:38PM +0100, Usama Arif wrote:
> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.

NIT, but would prefer a little more detail here e.g.:

	mm/huge_memory: rename variable for clarity

	There's no need to define a new local variable in
	__thp_vma_allowable_orders(), it's simply clearer to use the
	existing forced_collapse value to determine whether to force a
	collapse.

>
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>

LGTM, so:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
> This was agreed upon in [1]
> [1] https://lore.kernel.org/all/cd99f0f2-260d-4494-bbf6-99daec3e0683@gmail.com/
> ---
>  mm/huge_memory.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 6fd714bd04844..5220dbc9fcb31 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -105,7 +105,6 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
>  	const bool smaps = type == TVA_SMAPS;
>  	const bool in_pf = type == TVA_PAGEFAULT;
>  	const bool forced_collapse = type == TVA_FORCED_COLLAPSE;
> -	const bool enforce_sysfs = !forced_collapse;
>  	unsigned long supported_orders;
>
>  	/* Check the intersection of requested and supported orders. */
> @@ -168,14 +167,14 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
>  	if (!in_pf && shmem_file(vma->vm_file))
>  		return orders & shmem_allowable_huge_orders(file_inode(vma->vm_file),
>  						   vma, vma->vm_pgoff, 0,
> -						   !enforce_sysfs);
> +						   forced_collapse);
>
>  	if (!vma_is_anonymous(vma)) {
>  		/*
> -		 * Enforce sysfs THP requirements as necessary. Anonymous vmas
> +		 * Enforce THP collapse requirements as necessary. Anonymous vmas
>  		 * were already handled in thp_vma_allowable_orders().
>  		 */
> -		if (enforce_sysfs &&
> +		if (!forced_collapse &&
>  		    (!hugepage_global_enabled() || (!(vm_flags & VM_HUGEPAGE) &&
>  						    !hugepage_global_always())))
>  			return 0;
> --
> 2.47.3
>
>


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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
  2025-08-21 15:26 ` Zi Yan
  2025-08-21 15:33 ` Lorenzo Stoakes
@ 2025-08-21 15:35 ` Dev Jain
  2025-08-21 16:19 ` David Hildenbrand
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dev Jain @ 2025-08-21 15:35 UTC (permalink / raw)
  To: Usama Arif, Andrew Morton, david, lorenzo.stoakes, linux-mm
  Cc: ziy, baolin.wang, Liam.Howlett, npache, ryan.roberts, baohua,
	kernel-team


On 21/08/25 8:30 pm, Usama Arif wrote:
> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.
>
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> ---
> This was agreed upon in [1]
> [1] https://lore.kernel.org/all/cd99f0f2-260d-4494-bbf6-99daec3e0683@gmail.com/
> ---
>

Makes sense.

Reviewed-by: Dev Jain <dev.jain@arm.com>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
                   ` (2 preceding siblings ...)
  2025-08-21 15:35 ` Dev Jain
@ 2025-08-21 16:19 ` David Hildenbrand
  2025-08-21 16:51 ` SeongJae Park
  2025-08-22  3:46 ` Baolin Wang
  5 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2025-08-21 16:19 UTC (permalink / raw)
  To: Usama Arif, Andrew Morton, lorenzo.stoakes, linux-mm
  Cc: ziy, baolin.wang, Liam.Howlett, npache, ryan.roberts, dev.jain,
	baohua, kernel-team

On 21.08.25 17:00, Usama Arif wrote:
> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.
> 
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> ---

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

-- 
Cheers

David / dhildenb


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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
                   ` (3 preceding siblings ...)
  2025-08-21 16:19 ` David Hildenbrand
@ 2025-08-21 16:51 ` SeongJae Park
  2025-08-22  3:46 ` Baolin Wang
  5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2025-08-21 16:51 UTC (permalink / raw)
  To: Usama Arif
  Cc: SeongJae Park, Andrew Morton, david, lorenzo.stoakes, linux-mm,
	ziy, baolin.wang, Liam.Howlett, npache, ryan.roberts, dev.jain,
	baohua, kernel-team

On Thu, 21 Aug 2025 16:00:38 +0100 Usama Arif <usamaarif642@gmail.com> wrote:

> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.

Nice cleanup!

> 
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]


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

* Re: [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders
  2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
                   ` (4 preceding siblings ...)
  2025-08-21 16:51 ` SeongJae Park
@ 2025-08-22  3:46 ` Baolin Wang
  5 siblings, 0 replies; 7+ messages in thread
From: Baolin Wang @ 2025-08-22  3:46 UTC (permalink / raw)
  To: Usama Arif, Andrew Morton, david, lorenzo.stoakes, linux-mm
  Cc: ziy, Liam.Howlett, npache, ryan.roberts, dev.jain, baohua,
	kernel-team



On 2025/8/21 23:00, Usama Arif wrote:
> Using forced_collapse directly is clearer and enforce_sysfs is not
> really needed.
> 
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> ---

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> This was agreed upon in [1]
> [1] https://lore.kernel.org/all/cd99f0f2-260d-4494-bbf6-99daec3e0683@gmail.com/
> ---
>   mm/huge_memory.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 6fd714bd04844..5220dbc9fcb31 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -105,7 +105,6 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
>   	const bool smaps = type == TVA_SMAPS;
>   	const bool in_pf = type == TVA_PAGEFAULT;
>   	const bool forced_collapse = type == TVA_FORCED_COLLAPSE;
> -	const bool enforce_sysfs = !forced_collapse;
>   	unsigned long supported_orders;
>   
>   	/* Check the intersection of requested and supported orders. */
> @@ -168,14 +167,14 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
>   	if (!in_pf && shmem_file(vma->vm_file))
>   		return orders & shmem_allowable_huge_orders(file_inode(vma->vm_file),
>   						   vma, vma->vm_pgoff, 0,
> -						   !enforce_sysfs);
> +						   forced_collapse);
>   
>   	if (!vma_is_anonymous(vma)) {
>   		/*
> -		 * Enforce sysfs THP requirements as necessary. Anonymous vmas
> +		 * Enforce THP collapse requirements as necessary. Anonymous vmas
>   		 * were already handled in thp_vma_allowable_orders().
>   		 */
> -		if (enforce_sysfs &&
> +		if (!forced_collapse &&
>   		    (!hugepage_global_enabled() || (!(vm_flags & VM_HUGEPAGE) &&
>   						    !hugepage_global_always())))
>   			return 0;



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

end of thread, other threads:[~2025-08-22  3:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21 15:00 [PATCH] mm/huge_memory: remove enforce_sysfs from __thp_vma_allowable_orders Usama Arif
2025-08-21 15:26 ` Zi Yan
2025-08-21 15:33 ` Lorenzo Stoakes
2025-08-21 15:35 ` Dev Jain
2025-08-21 16:19 ` David Hildenbrand
2025-08-21 16:51 ` SeongJae Park
2025-08-22  3:46 ` Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).