[PATCH v1] drm/amdgpu: give each kernel job a unique id

Danilo Krummrich dakr at kernel.org
Fri Jun 13 08:42:20 UTC 2025


On Fri, Jun 13, 2025 at 10:29:35AM +0200, Philipp Stanner wrote:
> Shouldn't the xarray be used nowadays for ID allocation? I think
> idr_alloc_cyclic() (ida_alloc_cyclic() doesn't exist) is just a wrapper
> around the xarray anyways.

Yes, IDR is basically xarray under the hood. But, a raw xarray (or IDR) is
unnecessary overhead, since we don't need to store pointers.

While IDA also uses xarray under the hood, it does perform some tricks to
provide only ID numbers, but much more efficiently.

Given that there's no ida_alloc_cyclic(), the atomic is probably fine, even
though, ida_alloc_cyclic() doesn't sound like a bad idea to add in general.

But maybe it's difficult due to some of the optimization tricks IDA performs.

I think we should stick to the atomic for now, but add a proper API to reserve
kernel IDs.


More information about the dri-devel mailing list