[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190417090006.GC4038@hirez.programming.kicks-ass.net>
Date: Wed, 17 Apr 2019 11:00:06 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <longman@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, x86@...nel.org,
Davidlohr Bueso <dave@...olabs.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH v4 08/16] locking/rwsem: Make rwsem_spin_on_owner()
return owner state
On Sat, Apr 13, 2019 at 01:22:51PM -0400, Waiman Long wrote:
> This patch modifies rwsem_spin_on_owner() to return four possible
> values to better reflect the state of lock holder which enables us to
> make a better decision of what to do next.
>
> In the special case that there is no active lock and the handoff bit
> is set, optimistic spinning has to be stopped.
>
> Signed-off-by: Waiman Long <longman@...hat.com>
> ---
> kernel/locking/rwsem.c | 45 +++++++++++++++++++++++++++++++++++-------
> 1 file changed, 38 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index aaab546a890d..2d6850c3e77b 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -156,6 +156,11 @@ static inline bool is_rwsem_owner_spinnable(struct task_struct *owner)
> return !((unsigned long)owner & RWSEM_ANONYMOUSLY_OWNED);
> }
>
> +static inline bool is_rwsem_owner_reader(struct task_struct *owner)
> +{
> + return (unsigned long)owner & RWSEM_READER_OWNED;
> +}
Move this and the surrounding helpers into the RWSEM_SPIN_ON_OWNER
block, it is only used there and that way all the code is together.
Powered by blists - more mailing lists