[PATCH] um: vector: Replace locks guarding queue depth with atomics
Johannes Berg
johannes at sipsolutions.net
Thu Jul 4 02:54:33 PDT 2024
On Thu, 2024-07-04 at 10:45 +0100, Anton Ivanov wrote:
> > (it probably also never even executes twice unless you actually have SMP
> > or preemption?)
>
> It does. If half of the vector is at the end of the array which is used to
> imitate a ring buffer and the other half is at the beginning. Quite a common
> condition actually.
Ah, right, I missed this bit:
/* Adjust vector size if wraparound */
if (send_len + qi->head > qi->max_depth)
send_len = qi->max_depth - qi->head;
> There is an extra issue there - stats. I need to double-check the locking when
> they are being fetched.
The memcpy() is an issue, but I think reading them individually should
be OK regardless?
But I suppose you could just take both locks there, hopefully nobody is
accessing them _really_ frequently? At least I think you can take both
locks since now no other path is taking both? But you'd need
spin_lock_bh().
johannes
More information about the linux-um
mailing list