lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write
From
Date
On Tue, 2015-04-28 at 10:50 -0700, Jason Low wrote:
> On Tue, 2015-04-28 at 19:17 +0200, Peter Zijlstra wrote:
>
> > To me it makes more sense to reverse these two branches (identical code
> > wise of course) and put the special case first.
> >
> > Alternatively we could also do something like the below, which to my
> > eyes looks a little better still, but I don't care too much.
> >
> > if (rwsem_has_spinner(sem)) {
> > /*
> > * comment ...
> > */
> > smp_rmb();
> > if (!raw_spin_trylock_irqsave(&sem->wait_lock, flags))
> > return sem;
> > goto locked;
> > }
> >
> > raw_spin_lock_irqsave(&sem->wait_lock, flags);
> > locked:
>
> How about putting this into its own function:

I'd actually prefer reusing the current function. We have so many
utility functions that we've over-encapsulated the code a bit, it makes
reading _harder_, imho.

Thanks,
Davidlohr



\
 
 \ /
  Last update: 2015-04-28 20:21    [W:0.059 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site