Re: [PATCH v3 2/2] pid: only take pidmap_lock once on alloc
From: Mateusz Guzik
Date: Tue Dec 16 2025 - 13:28:26 EST
On Tue, Dec 16, 2025 at 6:09 PM Tycho Andersen <tycho@xxxxxxxxxx> wrote:
> In a particularly pathological case I can get a substantial
> improvement in kernel CPU time with this patch:
>
> Before: Time (mean ± σ): 53.007 s ± 0.148 s [User: 430.891 s, System: 12406.459 s]
> After : Time (mean ± σ): 45.624 s ± 0.394 s [User: 435.021 s, System: 7692.072 s]
>
> across 10 different boots. Feel free to add
>
> Tested-by: Tycho Andersen (AMD) <tycho@xxxxxxxxxx>
>
thanks for testing
> > + * (the routine unfortunately returns void, so we have no idea if it got anywhere).
>
> Is it worth changing the return type? The underlying function looks
> like it knows whether the allocation was actually successful...
>
willy says IDR is a stale api and the intent is to move consumers off
of it. the loop is already a result of not changing the api, see v1
which add preload for more than one buffer.
Whatever replacement should definitely indicate something like this if
preload exists for its case.