linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: "Xu, Yanfei" <yanfei.xu@windriver.com>
Cc: Linux MM <linux-mm@kvack.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] mm: khugepaged: check MMF_DISABLE_THP ahead of iterating over vmas
Date: Wed, 7 Apr 2021 14:40:56 -0700	[thread overview]
Message-ID: <CAHbLzkqR28PW9eYJAXCjXBL+=cxQDXFrXiPfDkxCDYPB+1HgiA@mail.gmail.com> (raw)
In-Reply-To: <20210407030548.189104-3-yanfei.xu@windriver.com>

On Tue, Apr 6, 2021 at 8:06 PM <yanfei.xu@windriver.com> wrote:
>
> From: Yanfei Xu <yanfei.xu@windriver.com>
>
> We could check MMF_DISABLE_THP ahead of iterating over all of vma.
> Otherwise if some mm_struct contain a large number of vma, there will
> be amounts meaningless cpu cycles cost.

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

>
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>  mm/khugepaged.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index a6012b9259a2..f4ad25a7db55 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -2094,6 +2094,8 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
>          */
>         if (unlikely(!mmap_read_trylock(mm)))
>                 goto breakouterloop_mmap_lock;
> +       if (test_bit(MMF_DISABLE_THP, &mm->flags))
> +               goto breakouterloop;
>         if (likely(!khugepaged_test_exit(mm)))
>                 vma = find_vma(mm, khugepaged_scan.address);
>
> --
> 2.27.0
>


  reply	other threads:[~2021-04-07 21:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  3:05 [PATCH v2 0/2] mm: khugepaged: cleanup and a minor tuning in THP yanfei.xu
2021-04-07  3:05 ` [PATCH v2 1/2] mm: khugepaged: use macro to align addresses yanfei.xu
2021-04-07 21:40   ` Yang Shi
2021-04-07  3:05 ` [PATCH v2 2/2] mm: khugepaged: check MMF_DISABLE_THP ahead of iterating over vmas yanfei.xu
2021-04-07 21:40   ` Yang Shi [this message]
2021-04-14  2:14 ` [PATCH v2 0/2] mm: khugepaged: cleanup and a minor tuning in THP Xu, Yanfei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHbLzkqR28PW9eYJAXCjXBL+=cxQDXFrXiPfDkxCDYPB+1HgiA@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yanfei.xu@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).