RE: [PATCH] Fix data race in mark_rt_mutex_waiters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux