diff mbox series

[1/7] mm/khugepaged: remove unneeded shmem_huge_enabled() check

Message ID 20220611084731.55155-2-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup patches for khugepaged | expand

Commit Message

Miaohe Lin June 11, 2022, 8:47 a.m. UTC
If we reach here, hugepage_vma_check() has already made sure that hugepage
is enabled for shmem. Remove this duplicated check.

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

Comments

Andrew Morton June 11, 2022, 8:33 p.m. UTC | #1
On Sat, 11 Jun 2022 16:47:25 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> If we reach here, hugepage_vma_check() has already made sure that hugepage
> is enabled for shmem. Remove this duplicated check.

I updated this to

If we reach here, hugepage_vma_check() has already made sure that hugepage
is enabled for shmem, via its call to hugepage_vma_check().  Remove this
duplicated check.
Miaohe Lin June 13, 2022, 1:48 a.m. UTC | #2
On 2022/6/12 4:33, Andrew Morton wrote:
> On Sat, 11 Jun 2022 16:47:25 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> 
>> If we reach here, hugepage_vma_check() has already made sure that hugepage
>> is enabled for shmem. Remove this duplicated check.
> 
> I updated this to
> 
> If we reach here, hugepage_vma_check() has already made sure that hugepage
> is enabled for shmem, via its call to hugepage_vma_check().  Remove this
> duplicated check.

Do you mean "khugepaged_scan_mm_slot() has already made sure that hugepage is
enabled for shmem, via its call to hugepage_vma_check()"?

Thanks!

> 
> .
>
Andrew Morton June 13, 2022, 6:02 p.m. UTC | #3
On Mon, 13 Jun 2022 09:48:27 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> > I updated this to
> > 
> > If we reach here, hugepage_vma_check() has already made sure that hugepage
> > is enabled for shmem, via its call to hugepage_vma_check().  Remove this
> > duplicated check.
> 
> Do you mean "khugepaged_scan_mm_slot() has already made sure that hugepage is
> enabled for shmem, via its call to hugepage_vma_check()"?

yup, thanks.
Zach O'Keefe June 15, 2022, 12:13 a.m. UTC | #4
On 11 Jun 16:47, Miaohe Lin wrote:
> If we reach here, hugepage_vma_check() has already made sure that hugepage
> is enabled for shmem. Remove this duplicated check.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/khugepaged.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 476d79360101..73570dfffcec 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -2153,8 +2153,6 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
>  		if (khugepaged_scan.address < hstart)
>  			khugepaged_scan.address = hstart;
>  		VM_BUG_ON(khugepaged_scan.address & ~HPAGE_PMD_MASK);
> -		if (shmem_file(vma->vm_file) && !shmem_huge_enabled(vma))
> -			goto skip;
>  
>  		while (khugepaged_scan.address < hend) {
>  			int ret;
> -- 
> 2.23.0
> 
> 

Thanks for these cleanups, Miaohe.

Reviewed-by: Zach O'Keefe <zokeefe@google.com>
Yang Shi June 15, 2022, 5:35 p.m. UTC | #5
On Sat, Jun 11, 2022 at 1:47 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> If we reach here, hugepage_vma_check() has already made sure that hugepage
> is enabled for shmem. Remove this duplicated check.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Yang Shi <shy828301@gmail.com>

> ---
>  mm/khugepaged.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 476d79360101..73570dfffcec 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -2153,8 +2153,6 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
>                 if (khugepaged_scan.address < hstart)
>                         khugepaged_scan.address = hstart;
>                 VM_BUG_ON(khugepaged_scan.address & ~HPAGE_PMD_MASK);
> -               if (shmem_file(vma->vm_file) && !shmem_huge_enabled(vma))
> -                       goto skip;
>
>                 while (khugepaged_scan.address < hend) {
>                         int ret;
> --
> 2.23.0
>
>
diff mbox series

Patch

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 476d79360101..73570dfffcec 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2153,8 +2153,6 @@  static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
 		if (khugepaged_scan.address < hstart)
 			khugepaged_scan.address = hstart;
 		VM_BUG_ON(khugepaged_scan.address & ~HPAGE_PMD_MASK);
-		if (shmem_file(vma->vm_file) && !shmem_huge_enabled(vma))
-			goto skip;
 
 		while (khugepaged_scan.address < hend) {
 			int ret;