[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C6E16C.5030703@intel.com>
Date: Sun, 23 Jun 2013 19:52:12 +0800
From: Alex Shi <alex.shi@...el.com>
To: Andi Kleen <andi@...stfloor.org>
CC: Peter Hurley <peter@...leysoftware.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Michel Lespinasse <walken@...gle.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Davidlohr Bueso <davidlohr.bueso@...com>,
Matthew R Wilcox <matthew.r.wilcox@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Rik van Riel <riel@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH 1/2] rwsem: check the lock before cpmxchg in down_write_trylock
and rwsem_do_wake
On 06/23/2013 01:10 PM, Andi Kleen wrote:
>>>> diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h
>>>> > >> index bb1e2cd..052d973 100644
>>>> > >> --- a/include/asm-generic/rwsem.h
>>>> > >> +++ b/include/asm-generic/rwsem.h
>>>> > >> @@ -70,11 +70,11 @@ static inline void __down_write(struct
>>>> > >> rw_semaphore *sem)
>>>> > >>
>>>> > >> static inline int __down_write_trylock(struct rw_semaphore *sem)
>>>> > >> {
>>>> > >> - long tmp;
>>>> > >> + if (unlikely(&sem->count != RWSEM_UNLOCKED_VALUE))
>>> > > ^^^^^^^^^^^
>>> > >
>>> > > This is probably not what you want.
>>> > >
>> >
>> > this function logical is quite simple. check the sem->count before
>> > cmpxchg is no harm this logical.
>> >
>> > So could you like to tell us what should we want?
> You are comparing the address, not the value. Remove the &
> This was a nop too.
ops, So stupid I am! :(
--
Thanks
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists