Re: [PATCH 1/2] rwsem: check the lock before cpmxchg in down_write_trylock and rwsem_do_wake

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

 



> >> 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.

-Andi
-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]