mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* xchg in fastpath for mutex unlock [mutex-xchg.h]
@ 2012-09-28 10:48 Shantanu Gupta
  2012-10-01 21:45 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Shantanu Gupta @ 2012-09-28 10:48 UTC (permalink / raw)
  To: linux-kernel

Hello,

I am currently studying mutex(es) and was referring to linux sources
for it's implementation. However I noticed one shortcoming, in
"/include/asm-generic/mutex-xchg.h" of the master branch inside
__mutex_fastpath_trylock, Why doesn't the kernel use a cmpxchg instead
of dirtying the value with xchg ?

(The only thing that came to my mind was that x86_x64 implementation
mentioned that all x86_x64 cpu(s) have cmpxchg leading me to
assumption that certain archs can have xchg but not cmpxchg, so is it
this way just to work with architectures without a cmpxchg but with
xchg ?)

Thanks,
Rick

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

end of thread, other threads:[~2012-10-01 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-28 10:48 xchg in fastpath for mutex unlock [mutex-xchg.h] Shantanu Gupta
2012-10-01 21:45 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®