Re: [PATCH-tip 04/22] locking/rwsem: Remove arch specific rwsem files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Subject: Re: [PATCH-tip 04/22] locking/rwsem: Remove arch specific rwsem files
- From: Waiman Long <longman@xxxxxxxxxx>
- Date: Thu, 7 Feb 2019 14:43:10 -0500
- Cc: Ingo Molnar <mingo@xxxxxxxxxx>, Will Deacon <will.deacon@xxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Davidlohr Bueso <dave@xxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
- In-reply-to: <20190207193656.GF32511@hirez.programming.kicks-ass.net>
- Openpgp: preference=signencrypt
- Organization: Red Hat
- References: <1549566446-27967-1-git-send-email-longman@redhat.com> <1549566446-27967-5-git-send-email-longman@redhat.com> <20190207193656.GF32511@hirez.programming.kicks-ass.net>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
On 02/07/2019 02:36 PM, Peter Zijlstra wrote:
> On Thu, Feb 07, 2019 at 02:07:08PM -0500, Waiman Long wrote:
>
>> +static inline int __down_read_trylock(struct rw_semaphore *sem)
>> +{
>> + long tmp;
>> +
>> + while ((tmp = atomic_long_read(&sem->count)) >= 0) {
>> + if (tmp == atomic_long_cmpxchg_acquire(&sem->count, tmp,
>> + tmp + RWSEM_ACTIVE_READ_BIAS)) {
>> + return 1;
>> + }
>> + }
> Nah, you're supposed to write that like:
>
> for (;;) {
> val = atomic_long_cond_read_relaxed(&sem->count, VAL < 0);
> if (atomic_long_try_cmpxchg_acquire(&sem->count, &val,
> val + RWSEM_ACTIVE_READ_BIAS))
> break;
> }
>
Ah, you are right. I just took it directly from the current generic
asm.h file and didn't pay much attention to it. I will fix that in the
next iteration.
>> + return 0;
>> +}
>
> Anyway, yuck, you're keeping all that BIAS nonsense :/ I was so hoping
> for a rwsem implementation without that impenetrable crap.
Well, I am going to take out all the BIAS handling in a later patch.
This one is just for removing the architecture specific files.
I can't change the rwsem count encoding before I take out all the arch
specific files.
Cheers,
Longman
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]