On 21.02.20 16:17, Jan Beulich wrote:
On 21.02.2020 16:13, Jürgen Groß wrote:
On 21.02.20 15:51, Julien Grall wrote:
You are assuming that atomic_t will always be:
struct
{
int counter;
}
What if we decide to turn into
struct
{
bool a;
int counter;
}
As said before: then queue_write_lock_slowpath() is already broken.
Why? The atomic_*() used would still only act on the counter field
(for their actual operation, i.e. what matters to callers; the
other field(s) could be statistics or whatever).
No:
u32 cnts;
...
if ( !(cnts & _QW_WMASK) &&
(atomic_cmpxchg(&lock->cnts, cnts,
cnts | _QW_WAITING) == cnts) )