lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [v2 PATCH 0/8] Make khugepaged collapse readonly FS THP more consistent
Date


> On Mar 17, 2022, at 4:48 PM, Yang Shi <shy828301@gmail.com> wrote:
>
>
> Changelog
> v2: * Collected reviewed-by tags from Miaohe Lin.
> * Fixed build error for patch 4/8.
>
> The readonly FS THP relies on khugepaged to collapse THP for suitable
> vmas. But it is kind of "random luck" for khugepaged to see the
> readonly FS vmas (see report: https://lore.kernel.org/linux-mm/00f195d4-d039-3cf2-d3a1-a2c88de397a0@suse.cz/) since currently the vmas are registered to khugepaged when:
> - Anon huge pmd page fault
> - VMA merge
> - MADV_HUGEPAGE
> - Shmem mmap
>
> If the above conditions are not met, even though khugepaged is enabled
> it won't see readonly FS vmas at all. MADV_HUGEPAGE could be specified
> explicitly to tell khugepaged to collapse this area, but when khugepaged
> mode is "always" it should scan suitable vmas as long as VM_NOHUGEPAGE
> is not set.
>
> So make sure readonly FS vmas are registered to khugepaged to make the
> behavior more consistent.
>
> Registering the vmas in mmap path seems more preferred from performance
> point of view since page fault path is definitely hot path.
>
>
> The patch 1 ~ 7 are minor bug fixes, clean up and preparation patches.
> The patch 8 converts ext4 and xfs. We may need convert more filesystems,
> but I'd like to hear some comments before doing that.
>
>
> Tested with khugepaged test in selftests and the testcase provided by
> Vlastimil Babka in https://lore.kernel.org/lkml/df3b5d1c-a36b-2c73-3e27-99e74983de3a@suse.cz/
> by commenting out MADV_HUGEPAGE call.

LGTM. For the series:

Acked-by: Song Liu <song@kernel.org>

>
>
> b/fs/ext4/file.c | 4 +++
> b/fs/xfs/xfs_file.c | 4 +++
> b/include/linux/huge_mm.h | 9 +++++++
> b/include/linux/khugepaged.h | 69 +++++++++++++++++++++----------------------------------------
> b/include/linux/sched/coredump.h | 3 +-
> b/kernel/fork.c | 4 ---
> b/mm/huge_memory.c | 15 +++----------
> b/mm/khugepaged.c | 71 ++++++++++++++++++++++++++++++++++++++++++++-------------------
> b/mm/shmem.c | 14 +++---------
> 9 files changed, 102 insertions(+), 91 deletions(-)
>

\
 
 \ /
  Last update: 2022-03-18 02:11    [W:0.132 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site