[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1526932382.7898.25.camel@surriel.com>
Date: Mon, 21 May 2018 15:53:02 -0400
From: Rik van Riel <riel@...riel.com>
To: Song Liu <songliubraving@...com>, linux-mm@...ck.org
Cc: kernel-team@...com, linux-kernel@...r.kernel.org,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH] mm/THP: use hugepage_vma_check() in
khugepaged_enter_vma_merge()
On Mon, 2018-05-21 at 12:38 -0700, Song Liu wrote:
> This patch fixes these problems by reusing hugepage_vma_check() in
> khugepaged_enter_vma_merge().
Lets take a look at this in more detail. This effectively
adds the following conditions to khugepaged_enter_vma_merge:
- fail if MMF_DISABLE_THP bit is set in mm->flags (good)
- allow if merging a tmpfs file and THP tmpfs is enabled (good)
- disallow if is_vma_temporary_stack (good)
- otherwise, allow if !VM_NO_KHUGEPAGED flag (good)
Looks like this covers all the conditions I can think
of, and if I missed any, chances are that condition
should be added to hugepage_vma_check()...
> Signed-off-by: Song Liu <songliubraving@...com>
Reviewed-by: Rik van Riel <riel@...riel.com>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index d7b2a4b..e50c2bd 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -430,18 +430,14 @@ int __khugepaged_enter(struct mm_struct *mm)
> return 0;
> }
>
> +static bool hugepage_vma_check(struct vm_area_struct *vma);
> +
> int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
> unsigned long vm_flags)
> {
> unsigned long hstart, hend;
> - if (!vma->anon_vma)
> - /*
> - * Not yet faulted in so we will register later in
> the
> - * page fault if needed.
> - */
> - return 0;
> - if (vma->vm_ops || (vm_flags & VM_NO_KHUGEPAGED))
> - /* khugepaged not yet working on file or special
> mappings */
> +
> + if (!hugepage_vma_check(vma))
> return 0;
> hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
> hend = vma->vm_end & HPAGE_PMD_MASK;
--
All Rights Reversed.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists