linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem.c: use helper transhuge_vma_enabled()
@ 2022-06-11  2:23 Miaohe Lin
  2022-06-11  3:14 ` Hugh Dickins
  0 siblings, 1 reply; 5+ messages in thread
From: Miaohe Lin @ 2022-06-11  2:23 UTC (permalink / raw)
  To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe

Use helper transhuge_vma_enabled() to check whether transhuge is enable
on vma. Minor readability improvement.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/shmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 133c67057d41..59cc2e980c95 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -480,8 +480,7 @@ bool shmem_is_huge(struct vm_area_struct *vma,
 		return false;
 	if (shmem_huge == SHMEM_HUGE_DENY)
 		return false;
-	if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
-	    test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
+	if (vma && !transhuge_vma_enabled(vma, vma->vm_flags))
 		return false;
 	if (shmem_huge == SHMEM_HUGE_FORCE)
 		return true;
-- 
2.23.0



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

* Re: [PATCH] mm/shmem.c: use helper transhuge_vma_enabled()
  2022-06-11  2:23 [PATCH] mm/shmem.c: use helper transhuge_vma_enabled() Miaohe Lin
@ 2022-06-11  3:14 ` Hugh Dickins
  2022-06-11  6:32   ` Miaohe Lin
  2022-06-15  5:02   ` Anshuman Khandual
  0 siblings, 2 replies; 5+ messages in thread
From: Hugh Dickins @ 2022-06-11  3:14 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: akpm, hughd, linux-mm, linux-kernel

On Sat, 11 Jun 2022, Miaohe Lin wrote:

> Use helper transhuge_vma_enabled() to check whether transhuge is enable
> on vma. Minor readability improvement.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

No thanks, that's a readability regression, forcing reader
to go and look up what transhuge_vma_enabled() actually means.

What you call a helper, I call an obfuscator - as I implied in
b9e2faaf6fa0 ("huge tmpfs: revert shmem's use of transhuge_vma_enabled()")

Hugh

> ---
>  mm/shmem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 133c67057d41..59cc2e980c95 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -480,8 +480,7 @@ bool shmem_is_huge(struct vm_area_struct *vma,
>  		return false;
>  	if (shmem_huge == SHMEM_HUGE_DENY)
>  		return false;
> -	if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
> -	    test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
> +	if (vma && !transhuge_vma_enabled(vma, vma->vm_flags))
>  		return false;
>  	if (shmem_huge == SHMEM_HUGE_FORCE)
>  		return true;
> -- 
> 2.23.0


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

* Re: [PATCH] mm/shmem.c: use helper transhuge_vma_enabled()
  2022-06-11  3:14 ` Hugh Dickins
@ 2022-06-11  6:32   ` Miaohe Lin
  2022-06-15  5:02   ` Anshuman Khandual
  1 sibling, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2022-06-11  6:32 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: akpm, linux-mm, linux-kernel

On 2022/6/11 11:14, Hugh Dickins wrote:
> On Sat, 11 Jun 2022, Miaohe Lin wrote:
> 
>> Use helper transhuge_vma_enabled() to check whether transhuge is enable
>> on vma. Minor readability improvement.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> No thanks, that's a readability regression, forcing reader
> to go and look up what transhuge_vma_enabled() actually means.
> 
> What you call a helper, I call an obfuscator - as I implied in
> b9e2faaf6fa0 ("huge tmpfs: revert shmem's use of transhuge_vma_enabled()")

Oh, that commit also cc to me. But I forgot it... Sorry.

> 
> Hugh
>


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

* Re: [PATCH] mm/shmem.c: use helper transhuge_vma_enabled()
  2022-06-11  3:14 ` Hugh Dickins
  2022-06-11  6:32   ` Miaohe Lin
@ 2022-06-15  5:02   ` Anshuman Khandual
  2022-06-16  0:40     ` Yang Shi
  1 sibling, 1 reply; 5+ messages in thread
From: Anshuman Khandual @ 2022-06-15  5:02 UTC (permalink / raw)
  To: Hugh Dickins, Miaohe Lin; +Cc: akpm, linux-mm, linux-kernel



On 6/11/22 08:44, Hugh Dickins wrote:
> On Sat, 11 Jun 2022, Miaohe Lin wrote:
> 
>> Use helper transhuge_vma_enabled() to check whether transhuge is enable
>> on vma. Minor readability improvement.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> No thanks, that's a readability regression, forcing reader
> to go and look up what transhuge_vma_enabled() actually means.
> 
> What you call a helper, I call an obfuscator - as I implied in
> b9e2faaf6fa0 ("huge tmpfs: revert shmem's use of transhuge_vma_enabled()")

The same reasoning should also be applicable for other calls sites
for transhuge_vma_enabled(). Should not they be dropped as well ?

> 
> Hugh
> 
>> ---
>>  mm/shmem.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 133c67057d41..59cc2e980c95 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -480,8 +480,7 @@ bool shmem_is_huge(struct vm_area_struct *vma,
>>  		return false;
>>  	if (shmem_huge == SHMEM_HUGE_DENY)
>>  		return false;
>> -	if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
>> -	    test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
>> +	if (vma && !transhuge_vma_enabled(vma, vma->vm_flags))
>>  		return false;
>>  	if (shmem_huge == SHMEM_HUGE_FORCE)
>>  		return true;
>> -- 
>> 2.23.0
> 


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

* Re: [PATCH] mm/shmem.c: use helper transhuge_vma_enabled()
  2022-06-15  5:02   ` Anshuman Khandual
@ 2022-06-16  0:40     ` Yang Shi
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Shi @ 2022-06-16  0:40 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: Hugh Dickins, Miaohe Lin, Andrew Morton, Linux MM,
	Linux Kernel Mailing List

On Tue, Jun 14, 2022 at 10:02 PM Anshuman Khandual
<anshuman.khandual@arm.com> wrote:
>
>
>
> On 6/11/22 08:44, Hugh Dickins wrote:
> > On Sat, 11 Jun 2022, Miaohe Lin wrote:
> >
> >> Use helper transhuge_vma_enabled() to check whether transhuge is enable
> >> on vma. Minor readability improvement.
> >>
> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> >
> > No thanks, that's a readability regression, forcing reader
> > to go and look up what transhuge_vma_enabled() actually means.
> >
> > What you call a helper, I call an obfuscator - as I implied in
> > b9e2faaf6fa0 ("huge tmpfs: revert shmem's use of transhuge_vma_enabled()")
>
> The same reasoning should also be applicable for other calls sites
> for transhuge_vma_enabled(). Should not they be dropped as well ?

Yes, the only caller was hugepage_vma_check(). It was changed to
open-code and the helper was removed by series:
https://lore.kernel.org/linux-mm/20220615172926.546974-1-shy828301@gmail.com/T/#m7610c2a4e5dda753cbc850986d5486f59a821c1a

>
> >
> > Hugh
> >
> >> ---
> >>  mm/shmem.c | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/mm/shmem.c b/mm/shmem.c
> >> index 133c67057d41..59cc2e980c95 100644
> >> --- a/mm/shmem.c
> >> +++ b/mm/shmem.c
> >> @@ -480,8 +480,7 @@ bool shmem_is_huge(struct vm_area_struct *vma,
> >>              return false;
> >>      if (shmem_huge == SHMEM_HUGE_DENY)
> >>              return false;
> >> -    if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
> >> -        test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
> >> +    if (vma && !transhuge_vma_enabled(vma, vma->vm_flags))
> >>              return false;
> >>      if (shmem_huge == SHMEM_HUGE_FORCE)
> >>              return true;
> >> --
> >> 2.23.0
> >
>


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

end of thread, other threads:[~2022-06-16  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  2:23 [PATCH] mm/shmem.c: use helper transhuge_vma_enabled() Miaohe Lin
2022-06-11  3:14 ` Hugh Dickins
2022-06-11  6:32   ` Miaohe Lin
2022-06-15  5:02   ` Anshuman Khandual
2022-06-16  0:40     ` Yang Shi

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).