Re: [PATCH 2/2] mm/rmap: Improve mlock tracking for large folios

From: Shakeel Butt

Date: Thu Sep 18 2025 - 15:32:20 EST


On Thu, Sep 18, 2025 at 12:21:57PM +0100, kirill@xxxxxxxxxxxxx wrote:
> From: Kiryl Shutsemau <kas@xxxxxxxxxx>
>
> The kernel currently does not mlock large folios when adding them to
> rmap, stating that it is difficult to confirm that the folio is fully
> mapped and safe to mlock it. However, nowadays the caller passes a
> number of pages of the folio that are getting mapped, making it easy to
> check if the entire folio is mapped to the VMA.
>
> mlock the folio on rmap if it is fully mapped to the VMA.
>
> Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>

Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>

It would be interesting to state how this specific issue was causing
problems in our production particularly for workloads that were doing
load shedding based on mlock stats.