[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180518070258.GA20971@gmail.com>
Date: Fri, 18 May 2018 09:02:58 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: Waiman Long <longman@...hat.com>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Davidlohr Bueso <dave@...olabs.net>,
"Theodore Y. Ts'o" <tytso@....edu>,
Oleg Nesterov <oleg@...hat.com>,
Amir Goldstein <amir73il@...il.com>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH v4 1/2] locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED
flag
* Matthew Wilcox <willy@...radead.org> wrote:
> On Tue, May 15, 2018 at 05:49:50PM -0400, Waiman Long wrote:
> > @@ -357,11 +357,8 @@ static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)
> >
> > rcu_read_lock();
> > owner = READ_ONCE(sem->owner);
> > - if (!rwsem_owner_is_writer(owner)) {
> > - /*
> > - * Don't spin if the rwsem is readers owned.
> > - */
> > - ret = !rwsem_owner_is_reader(owner);
> > + if (!owner || !is_rwsem_owner_spinnable(owner)) {
> > + ret = !owner; /* !owner is spinnable */
> > goto done;
> > }
>
> This is confusingly written. I think you mean ...
>
> if (!owner)
> goto done;
> if (!is_rwsem_owner_spinnable(owner)) {
> ret = false;
> goto done;
> }
Yes, that's cleaner. Waiman, mind sending a followup patch that cleans this up?
Thanks,
Ingo
Powered by blists - more mailing lists