lkml.org 
[lkml]   [2019]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v4 08/16] locking/rwsem: Make rwsem_spin_on_owner() return owner state
    From
    Date
    On 04/17/2019 05:00 AM, Peter Zijlstra wrote:
    > 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@redhat.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.

    OK, will do that.

    Cheers,
    Longman

    \
     
     \ /
      Last update: 2019-04-17 18:43    [W:6.387 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site