[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ttd3t1yd.fsf@intel.com>
Date: Wed, 23 Oct 2024 15:53:46 +0300
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Uros Bizjak <ubizjak@...il.com>, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>, Joonas Lahtinen
<joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>
Subject: Re: [PATCH] drm/i915/active: Use try_cmpxchg() in active_fence_cb()
On Thu, 03 Oct 2024, Uros Bizjak <ubizjak@...il.com> wrote:
> Replace this pattern in active_fence_cb():
>
> cmpxchg(*ptr, old, new) == old
>
> ... with the simpler and faster:
>
> try_cmpxchg(*ptr, &old, new)
>
> The x86 CMPXCHG instruction returns success in the ZF flag,
> so this change saves a compare after the CMPXCHG.
>
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Cc: Jani Nikula <jani.nikula@...ux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>
> Cc: Tvrtko Ursulin <tursulin@...ulin.net>
> Cc: David Airlie <airlied@...il.com>
> Cc: Simona Vetter <simona@...ll.ch>
Pushed to drm-intel-next, thanks for the patch.
BR,
Jani.
> ---
> drivers/gpu/drm/i915/i915_active.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
> index 5ec293011d99..35319228bc51 100644
> --- a/drivers/gpu/drm/i915/i915_active.c
> +++ b/drivers/gpu/drm/i915/i915_active.c
> @@ -212,7 +212,7 @@ active_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
> struct i915_active_fence *active =
> container_of(cb, typeof(*active), cb);
>
> - return cmpxchg(__active_fence_slot(active), fence, NULL) == fence;
> + return try_cmpxchg(__active_fence_slot(active), &fence, NULL);
> }
>
> static void
--
Jani Nikula, Intel
Powered by blists - more mailing lists