[PATCH 1/4] drm/sched: optimize drm_sched_job_add_dependency
Danilo Krummrich
dakr at kernel.org
Mon May 26 11:14:34 UTC 2025
(Cc: Matthew)
Let's get this clarified to not work with assumptions. :)
On Mon, May 26, 2025 at 12:59:41PM +0200, Christian König wrote:
> On 5/24/25 13:17, Danilo Krummrich wrote:
> > On Fri, May 23, 2025 at 04:11:39PM +0200, Danilo Krummrich wrote:
> > So, your code here should be correct. However, I'd still remove the goto and
> > just call xas_store() again. There's no reason to make this a loop and backwards
> > goto is better avoided anyways. :)
>
>
> I was considering that as well, but than abandoned this idea. The xarray() sample code and test cases as well as the use cases where I took a look either use a loop or a goto.
>
> I'm not 100% sure why, my suspicion is that you need the loop when there can be concurrent add/remove operations on the xarray, but I think we should stick with the common approach.
I don't think that concurrency is relevant here. xas_nomem() stores the
allocated memory in the XA_STATE structure, which is on the stack.
I know that for maple tree a pre-allocation is only valid for the exact state
of the tree it was allocated for.
But I think xarray does not have this limitation, i.e. concurrent modification
of the xarray does not invalidate an xas_nomem() allocation in terms of being
sufficient for a subsequent store.
@Matthew: Can you clarify this please?
More information about the dri-devel
mailing list