diff mbox series

[mm-unstable,v7,01/18] mm/khugepaged: remove redundant transhuge_vma_suitable() check

Message ID 20220706235936.2197195-2-zokeefe@google.com (mailing list archive)
State New
Headers show
Series mm: userspace hugepage collapse | expand

Commit Message

Zach O'Keefe July 6, 2022, 11:59 p.m. UTC
transhuge_vma_suitable() is called twice in hugepage_vma_revalidate()
path.  Remove the first check, and rely on the second check inside
hugepage_vma_check().

Signed-off-by: Zach O'Keefe <zokeefe@google.com>
---
 mm/khugepaged.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Yang Shi July 11, 2022, 8:38 p.m. UTC | #1
On Wed, Jul 6, 2022 at 5:06 PM Zach O'Keefe <zokeefe@google.com> wrote:
>
> transhuge_vma_suitable() is called twice in hugepage_vma_revalidate()
> path.  Remove the first check, and rely on the second check inside
> hugepage_vma_check().
>
> Signed-off-by: Zach O'Keefe <zokeefe@google.com>
> ---
>  mm/khugepaged.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index cfe231c5958f..5269d15e20f6 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -918,8 +918,6 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address,
>         if (!vma)
>                 return SCAN_VMA_NULL;
>
> -       if (!transhuge_vma_suitable(vma, address))
> -               return SCAN_ADDRESS_RANGE;

It seems this is the only user of SCAN_ADDRESS_RANGE, so
SCAN_ADDRESS_RANGE could be deleted as well.

>         if (!hugepage_vma_check(vma, vma->vm_flags, false, false))
>                 return SCAN_VMA_CHECK;
>         /*
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>
Zach O'Keefe July 12, 2022, 5:14 p.m. UTC | #2
On Jul 11 13:38, Yang Shi wrote:
> On Wed, Jul 6, 2022 at 5:06 PM Zach O'Keefe <zokeefe@google.com> wrote:
> >
> > transhuge_vma_suitable() is called twice in hugepage_vma_revalidate()
> > path.  Remove the first check, and rely on the second check inside
> > hugepage_vma_check().
> >
> > Signed-off-by: Zach O'Keefe <zokeefe@google.com>
> > ---
> >  mm/khugepaged.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index cfe231c5958f..5269d15e20f6 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -918,8 +918,6 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address,
> >         if (!vma)
> >                 return SCAN_VMA_NULL;
> >
> > -       if (!transhuge_vma_suitable(vma, address))
> > -               return SCAN_ADDRESS_RANGE;
> 
> It seems this is the only user of SCAN_ADDRESS_RANGE, so
> SCAN_ADDRESS_RANGE could be deleted as well.
>

Good catch! Was able to remove this.

Thanks again,
Zach

> >         if (!hugepage_vma_check(vma, vma->vm_flags, false, false))
> >                 return SCAN_VMA_CHECK;
> >         /*
> > --
> > 2.37.0.rc0.161.g10f37bed90-goog
> >
diff mbox series

Patch

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index cfe231c5958f..5269d15e20f6 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -918,8 +918,6 @@  static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address,
 	if (!vma)
 		return SCAN_VMA_NULL;
 
-	if (!transhuge_vma_suitable(vma, address))
-		return SCAN_ADDRESS_RANGE;
 	if (!hugepage_vma_check(vma, vma->vm_flags, false, false))
 		return SCAN_VMA_CHECK;
 	/*