[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vc7lycvsvehisjr5drbng2lupytme3grubxbtgavvvjknkgzd6@axgctxng4424>
Date: Fri, 19 Sep 2025 14:18:56 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Kiryl Shutsemau <kirill@...temov.name>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>, Hugh Dickins <hughd@...gle.com>,
Matthew Wilcox <willy@...radead.org>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>, Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>, Rik van Riel <riel@...riel.com>,
Harry Yoo <harry.yoo@...cle.com>, Johannes Weiner <hannes@...xchg.org>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Kiryl Shutsemau <kas@...nel.org>
Subject: Re: [PATCHv2 2/5] mm/rmap: Fix a mlock race condition in
folio_referenced_one()
On Fri, Sep 19, 2025 at 01:40:33PM +0100, Kiryl Shutsemau wrote:
> From: Kiryl Shutsemau <kas@...nel.org>
>
> The mlock_vma_folio() function requires the page table lock to be held
> in order to safely mlock the folio. However, folio_referenced_one()
> mlocks a large folios outside of the page_vma_mapped_walk() loop where
> the page table lock has already been dropped.
>
> Rework the mlock logic to use the same code path inside the loop for
> both large and small folios.
>
> Use PVMW_PGTABLE_CROSSED to detect when the folio is mapped across a
> page table boundary.
>
> Signed-off-by: Kiryl Shutsemau <kas@...nel.org>
Nice, this simplifies the code.
Reviewed-by: Shakeel Butt <shakeel.butt@...ux.dev>
Powered by blists - more mailing lists