From: Lance Yang <ioworker0@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Yang Shi <shy828301@gmail.com>
Cc: mhocko@suse.com, zokeefe@google.com, david@redhat.com,
songmuchun@bytedance.com, peterx@redhat.com, minchan@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/khugepaged: bypassing unnecessary scans with MMF_DISABLE_THP check
Date: Fri, 23 Feb 2024 15:59:07 +0800 [thread overview]
Message-ID: <CAK1f24nzfh9n5qZ=uMSC_WP8g0HCmOpRrZZAM0FYOfpp1CD-Yw@mail.gmail.com> (raw)
In-Reply-To: <20240222131151.4d24563d58240e76a3b535db@linux-foundation.org>
Thanks for taking the time to look into this!
Thanks, Yang and Andrew!
Best,
Lance
On Fri, Feb 23, 2024 at 5:11 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu, 22 Feb 2024 12:23:21 -0800 Yang Shi <shy828301@gmail.com> wrote:
>
> > > VMA Count | Old | New | Change
> > > ---------------------------------------
> > > 50 | 23us | 9us | -60.9%
> > > 100 | 32us | 9us | -71.9%
> > > 200 | 44us | 9us | -79.5%
> > > 400 | 75us | 9us | -88.0%
> > > 800 | 98us | 9us | -90.8%
> > >
> > > IIUC, once the count of VMAs for the process
> > > exceeds page_to_scan, khugepaged needs to
> > > wait for scan_sleep_millisecs ms before scanning
> > > the next process. IMO, unnecessary scans could
> > > actually be skipped with a very inexpensive
> > > mm->flags check in this case.
> >
> > Thanks for following up on this, can you please capture all the
> > information in the commit log?
>
> I added it.
>
> --- a/txt/mm-khugepaged-bypassing-unnecessary-scans-with-mmf_disable_thp-check.txt
> +++ b/txt/mm-khugepaged-bypassing-unnecessary-scans-with-mmf_disable_thp-check.txt
> @@ -9,6 +9,24 @@ and the MMF_DISABLE_THP flag is set later, this scanning process
> becomes unnecessary for that mm and can be skipped to avoid redundant
> operations, especially in scenarios with a large address space.
>
> +On an Intel Core i5 CPU, the time taken by khugepaged to scan the
> +address space of the process, which has been set with the
> +MMF_DISABLE_THP flag after being added to the mm_slots list, is as
> +follows (shorter is better):
> +
> +VMA Count | Old | New | Change
> +---------------------------------------
> + 50 | 23us | 9us | -60.9%
> + 100 | 32us | 9us | -71.9%
> + 200 | 44us | 9us | -79.5%
> + 400 | 75us | 9us | -88.0%
> + 800 | 98us | 9us | -90.8%
> +
> +Once the count of VMAs for the process exceeds page_to_scan, khugepaged
> +needs to wait for scan_sleep_millisecs ms before scanning the next
> +process. IMO, unnecessary scans could actually be skipped with a very
> +inexpensive mm->flags check in this case.
> +
> This commit introduces a check before each scanning process to test the
> MMF_DISABLE_THP flag for the given mm; if the flag is set, the scanning
> process is bypassed, thereby improving the efficiency of khugepaged.
>
next prev parent reply other threads:[~2024-02-23 7:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 5:45 [PATCH 1/1] mm/khugepaged: bypassing unnecessary scans with MMF_DISABLE_THP check Lance Yang
2024-01-29 16:28 ` Michal Hocko
2024-01-30 2:12 ` Lance Yang
2024-01-30 3:08 ` Lance Yang
2024-01-30 9:35 ` Michal Hocko
2024-01-30 9:46 ` Lance Yang
2024-01-31 0:37 ` Lance Yang
2024-01-29 18:53 ` Yang Shi
2024-01-29 19:03 ` Zach O'Keefe
2024-01-30 2:37 ` Lance Yang
2024-01-30 2:21 ` Lance Yang
2024-01-31 9:30 ` Lance Yang
2024-01-31 20:06 ` Yang Shi
2024-02-01 1:13 ` Lance Yang
2024-02-01 18:56 ` Yang Shi
2024-02-03 3:20 ` Lance Yang
2024-02-21 22:11 ` Andrew Morton
2024-02-22 7:43 ` Lance Yang
2024-02-22 7:51 ` Lance Yang
2024-02-22 8:51 ` David Hildenbrand
2024-02-22 9:12 ` Lance Yang
2024-02-22 20:23 ` Yang Shi
2024-02-22 21:11 ` Andrew Morton
2024-02-23 7:59 ` Lance Yang [this message]
2024-02-24 1:47 ` Yang Shi
2024-02-24 1:46 ` Yang Shi
2024-02-24 3:54 ` Lance Yang
2024-02-25 4:56 ` Lance Yang
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='CAK1f24nzfh9n5qZ=uMSC_WP8g0HCmOpRrZZAM0FYOfpp1CD-Yw@mail.gmail.com' \
--to=ioworker0@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=peterx@redhat.com \
--cc=shy828301@gmail.com \
--cc=songmuchun@bytedance.com \
--cc=zokeefe@google.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).