Re: [PATCH 1/2] block/mq-deadline: serialize request dispatching

Bart Van Assche
2024-01-18T18:51:46Z

On 1/18/24 10:45, Jens Axboe wrote:
> Do you read the replies to the emails, from the other thread?

Yes.
> And secondly, this avoids a RMW if it's already set.
From the spinlock implementation (something I looked up before I wrote
my previous reply):

static __always_inline int queued_spin_trylock(struct qspinlock *lock)
{
int val = atomic_read(&lock->val);

if (unlikely(val))
return 0;

return likely(atomic_try_cmpxchg_acquire(&lock->val, &val,
_Q_LOCKED_VAL));
}

I think this implementation does not perform a RMW if the spinlock is
already locked.

Thanks,

Bart.