On 4/24/2020 12:29 AM, Daniel Wagner wrote:
Shouldn't this be q->n_posted++ ? Or is it garanteed n_posted is 0?
yes - we post 1 at a time.
Sorry to ask again, but I worried that sli_mq_write() is called while there is
work pending. Maybe it could at least documented with something like
WARN_ON_ONCE(n_posted != 0)
Yes - I'm having us re-look at the q->n_posted field. n_posted is to be
used as an accumulator for when consuming or posting multiple elements
from/to a queue. As RQ and MQ are not doing multiples, it makes no sense
to set the field to one. So the DB writes will just explicitly set the
DB value and ignore the field. The only code then setting n_posted will
be the code that actually uses it as an accumulator. This should
address your concerns. We'll also look at whether the queue structure
is actually defined well - meaning perhaps it should contain common
definitions (used by all queues) and a union of per-queue-type structs -
so it's very clear what things a queue-type accesses. Not sure what will
look the cleanest in the end, but that's the thinking.
-- james