Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH] Fix data race in mark_rt_mutex_waiters | Date | Fri, 20 Jan 2023 16:58:20 +0000 |
| |
From: Peter Zijlstra > Sent: 20 January 2023 16:23 ... > > do { > > - owner = *p; > > + owner = READ_ONCE(*p); > > } while (cmpxchg_relaxed(p, owner, > > owner | RT_MUTEX_HAS_WAITERS) != owner); > > > > Can't we replace the whole of that function with: > > set_bit(0, (unsigned long *)&lock->owner); > > ?
If you need the cast then probably not...
There really ought to be a compile-time test (somehow) that set_bit() is only used on large bit arrays.
OTOH atomic_or32/64() and atomic_and32/64() might use usable in many places.
On x86 I doubt it makes much difference whether you use 'bis' or 'lock or'.
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |