linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* WARNING: mutexes are preferred for single holder semaphores
@ 2008-05-05  0:41 Sean MacLennan
  2008-05-05  1:06 ` Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sean MacLennan @ 2008-05-05  0:41 UTC (permalink / raw)
  To: linuxppc-dev

This is a bit OT, but I got the warning in the subject from
checkpatch.pl for a piece of code. The code *is* using a mutex. Does it
actually mean I shouldn't use a mutex?

The code declares a global mutex:

	static DECLARE_MUTEX(list_lock);

The odds of two accesses to the list_lock at the same time are zero.
But it would be Very Bad(tm) if it did happen. Since the odds of
contention are near zero, the cost of the mutex is near zero, so I put
it in.

I think I can safely ignore the warning, but I want to make sure....

Cheers,
  Sean

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-05-08 13:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-05  0:41 WARNING: mutexes are preferred for single holder semaphores Sean MacLennan
2008-05-05  1:06 ` Michael Ellerman
2008-05-05  1:31   ` Sean MacLennan
2008-05-05  2:13 ` Paul Mackerras
2008-05-05  6:01   ` Christoph Hellwig
2008-05-05  3:38 ` Benjamin Herrenschmidt
2008-05-05  4:40   ` Sean MacLennan
2008-05-07 14:36     ` All your drivers are belong to us [was WARNING: mutexes are preferred for single holder semaphores] Detlev Zundel
2008-05-07 21:42       ` All your drivers are belong to us [was WARNING: mutexes are preferredfor " Sean MacLennan
2008-05-08  0:49         ` Josh Boyer
2008-05-08  4:41           ` Sean MacLennan
2008-05-08 13:28           ` All your drivers are belong to us Detlev Zundel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).