Re: [RFC PATCH 11/11] mm, swap: serialize xswap map/unmap with a mutex

From: Baoquan He

Date: Wed Aug 05 2026 - 04:15:59 EST


On 07/27/26 at 08:13am, Nhat Pham wrote:
> On Mon, Jul 27, 2026 at 7:06 AM Baoquan He <baoquan.he@xxxxxxxxx> wrote:
> >
> > Concurrent xswap grow operations race on vm_area_map_pages(),
> > triggering WARN_ON(!pte_none) in the vmap page table walk when
> > one thread sees a PTE already set by another. The -EBUSY safety
> > net catches it but the warning is noisy and unavoidable without
> > serialization.
> >
> > Add a per-device mutex (xswap_lock) held across xswap_map_clusters
> > and xswap_unmap_clusters so that only one thread can modify the
> > VM_SPARSE page table at a time. The shrink path is already
> > deferred to a workqueue so it does not contend with itself.
> >
> > Signed-off-by: Baoquan He <baoquan.he@xxxxxxxxx>
>
> Seems like this should be squashed into one of the older patches, no?

Both is fine to me, because putting it in a separate patch can get a
specific log to describe it with more details. Have squashed it into
patch 03 as suggested since they are small number of lines of change.

Thanks
Baoquan