[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK1f24nzfh9n5qZ=uMSC_WP8g0HCmOpRrZZAM0FYOfpp1CD-Yw@mail.gmail.com>
Date: Fri, 23 Feb 2024 15:59:07 +0800
From: Lance Yang <ioworker0@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Yang Shi <shy828301@...il.com>
Cc: mhocko@...e.com, zokeefe@...gle.com, david@...hat.com,
songmuchun@...edance.com, peterx@...hat.com, minchan@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] mm/khugepaged: bypassing unnecessary scans with
MMF_DISABLE_THP check
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@...ux-foundation.org> wrote:
>
> On Thu, 22 Feb 2024 12:23:21 -0800 Yang Shi <shy828301@...il.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.
>
Powered by blists - more mailing lists