This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using __kuser_cmpxchg


Pavel Pisa writes:
 > On Friday 16 November 2007 02:17, Nicolas Pitre wrote:
 > topic and do not see real problem,
 > but I have next idea.
 > 
 > There could occur four cases during cmpxchg/CAS processing
 > 
 >                  no disturbance    exception, etc.
 >   old==actual        succeed         FAIL
 >   old!=actual        fail            fail
 > 
 > The problematic case from the caller point of view is the false
 > "FAIL" case which could be incompatible with some other logic
 > (requires retry/busy loop) even that in "fail" case some other
 > activity - sleep report failure etc.
 > 
 > The expected can be achieved by two ways:
 >  - wrap up cmpxchg_orig() such way, that
 > 
 >    cmpxchg(ptr, old, new)
 >      do {
 >        ret = cmpxchg_orig()
 >      } while ((ret!=old) && (*ptr==old));

cmpxchg_orig returns a boolean, but I guess you could do

do {
  ret = cmpxchg_orig(ptr, old, new);
} while (ret && (*ptr == old));

That would be enough for me.  However, I'm quite anxious to get the
kernel version changed in case it trips up other people who don't read
the documentation carefully enough.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]