Re: [PATCH 0/3] further damage-control lack of clone scalability

From: Matthew Wilcox

Date: Sun Nov 23 2025 - 10:00:34 EST


On Sun, Nov 23, 2025 at 07:30:51AM +0100, Mateusz Guzik wrote:
> When spawning and killing threads in separate processes in parallel the
> primary bottleneck on the stock kernel is pidmap_lock, largely because
> of a back-to-back acquire in the common case.
>
> Benchmark code at the end.
>
> With this patchset alloc_pid() only takes the lock once and consequently
> alleviates the problem. While scalability improves, the lock remains the
> primary bottleneck by a large margin.
>
> I believe idr is a poor choice for the task at hand to begin with, but
> sorting out that out beyond the scope of this patchset. At the same time
> any replacement would be best evaluated against a state where the
> above relock problem is fixed.

Good news! The IDR is deprecated. Bad news! I'm not 100% sure that
the XArray is quite appropriate for this usecase. I am opposed to
introducing more IDR APIs. Have you looked at converting to the XArray?
Or do you have a better data structure in mind than the XArray?