[PATCH 1/4] drm/sched: optimize drm_sched_job_add_dependency
Danilo Krummrich
dakr at kernel.org
Sat May 24 11:17:11 UTC 2025
On Fri, May 23, 2025 at 04:11:39PM +0200, Danilo Krummrich wrote:
> On Fri, May 23, 2025 at 02:56:40PM +0200, Christian König wrote:
> > + if (xas_nomem(&xas, GFP_KERNEL)) {
> > + xa_lock(&job->dependencies);
> > + goto retry;
>
> Please don't use a goto here, if we would have failed to allocate memory here,
> this would be an endless loop until we succeed eventually.
I think I got confused by xas_nomem() returning true meaning that memory was
needed and was successfully allocated (which can be a bit counterintuitive).
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. :)
More information about the amd-gfx
mailing list