Thread (181 messages) 181 messages, 12 authors, 2023-11-22

Re: [PATCH 18/41] mm/khugepaged: write-lock VMA while collapsing a huge page

From: Michal Hocko <mhocko@suse.com>
Date: 2023-01-17 15:26:31
Also in: linux-arm-kernel, linux-mm, lkml

On Mon 09-01-23 12:53:13, Suren Baghdasaryan wrote:
Protect VMA from concurrent page fault handler while collapsing a huge
page. Page fault handler needs a stable PMD to use PTL and relies on
per-VMA lock to prevent concurrent PMD changes. pmdp_collapse_flush(),
set_huge_pmd() and collapse_and_free_pmd() can modify a PMD, which will
not be detected by a page fault handler without proper locking.
I am struggling with this changelog. Maybe because my recollection of
the THP collapsing subtleties is weak. But aren't you just trying to say
that the current #PF handling and THP collapsing need to be mutually
exclusive currently so in order to keep that assumption you have mark
the vma write locked?

Also it is not really clear to me how that handles other vmas which can
share the same thp?
-- 
Michal Hocko
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help