Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314543

Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list is not NULL.

From Tim Chen <tim.c.chen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list is not NULL.
Date 2016-01-21 22:30 +0100
Message-ID <qTuXM-2zU-19@gated-at.bofh.it> (permalink)
References <qTjSG-3ll-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2016-01-21 at 17:29 +0800, Ding Tianhong wrote:

> 
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 0551c21..596b341 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -256,7 +256,7 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock)
>  	struct task_struct *owner;
>  	int retval = 1;
>  
> -	if (need_resched())
> +	if (need_resched() || atomic_read(&lock->count) == -1)
>  		return 0;
>  

One concern I have is this change will eliminate any optimistic spinning
as long as there is a waiter.  Is there a middle ground that we
can allow only one spinner if there are waiters?  

In other words, we allow spinning when
atomic_read(&lock->count) == -1 but there is no one on the
osq lock that queue up the spinners (i.e. no other process doing
optimistic spinning).

This could allow a bit of spinning without starving out the waiters.

Tim

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC] locking/mutexes: don't spin on owner when wait list is  not NULL. Ding Tianhong <dingtianhong@huawei.com> - 2016-01-21 10:40 +0100
  Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Tim Chen <tim.c.chen@linux.intel.com> - 2016-01-21 22:30 +0100
    Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Davidlohr Bueso <dave@stgolabs.net> - 2016-01-22 03:50 +0100
      Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-01-22 04:20 +0100
    Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-01-22 03:50 +0100
  Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Waiman Long <waiman.long@hpe.com> - 2016-01-22 00:10 +0100
    Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Davidlohr Bueso <dave@stgolabs.net> - 2016-01-22 07:20 +0100
      Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Waiman Long <waiman.long@hpe.com> - 2016-01-22 14:40 +0100
        Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Davidlohr Bueso <dave@stgolabs.net> - 2016-01-22 17:50 +0100
          [PATCH] locking/mutex: Allow next waiter lockless wakeup Davidlohr Bueso <dave@stgolabs.net> - 2016-01-25 03:30 +0100
            Re: [PATCH] locking/mutex: Allow next waiter lockless wakeup Waiman Long <waiman.long@hpe.com> - 2016-01-26 00:10 +0100
    Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Peter Zijlstra <peterz@infradead.org> - 2016-01-22 10:00 +0100
      Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Jason Low <jason.low2@hp.com> - 2016-01-22 11:30 +0100
        Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Peter Zijlstra <peterz@infradead.org> - 2016-01-22 12:00 +0100
          Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Peter Zijlstra <peterz@infradead.org> - 2016-01-22 12:00 +0100
            Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Peter Zijlstra <peterz@infradead.org> - 2016-01-22 12:10 +0100
              Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Waiman Long <waiman.long@hpe.com> - 2016-01-22 15:10 +0100
                Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Ding Tianhong <dingtianhong@huawei.com> - 2016-01-24 09:10 +0100
      Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list  is not NULL. Waiman Long <waiman.long@hpe.com> - 2016-01-22 14:50 +0100

csiph-web