Re: [PATCH RFC] reduce runqueue lock contention

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Peter Zijlstra
Date: Thursday, May 20, 2010 - 2:09 pm

On Thu, 2010-05-20 at 16:48 -0400, Chris Mason wrote:

Right, so one of the things that I considered was to make p->state an
atomic_t and replace the initial stage of try_to_wake_up() with
something like:

int try_to_wake_up(struct task *p, unsigned int mask, wake_flags)
{
  int state = atomic_read(&p->state);

  do {
    if (!(state & mask))
      return 0;

    state = atomic_cmpxchg(&p->state, state, TASK_WAKING);
  } while (state != TASK_WAKING);

  /* do this pending queue + ipi thing */

  return 1;
}

Also, I think we might want to put that atomic single linked list thing
into some header (using atomic_long_t or so), because I have a similar
thing living in kernel/perf_event.c, that needs to queue things from NMI
context.

The advantage of doing basically the whole enqueue on the remote cpu is
less cacheline bouncing of the runqueue structures.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH RFC] reduce runqueue lock contention, Chris Mason, (Thu May 20, 1:48 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Thu May 20, 2:09 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Thu May 20, 2:23 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Chris Mason, (Thu May 20, 3:17 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Chris Mason, (Thu May 20, 3:21 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Stijn Devriendt, (Fri Jun 4, 3:56 am)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Fri Jun 4, 5:00 am)
Re: [PATCH RFC] reduce runqueue lock contention, Stijn Devriendt, (Sat Jun 5, 2:37 am)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Mon Jun 21, 3:02 am)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Mon Jun 21, 3:54 am)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Mon Jun 21, 6:04 am)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Tue Jun 22, 6:33 am)
Re: [PATCH RFC] reduce runqueue lock contention, Ingo Molnar, (Tue Jun 22, 2:11 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Wed Jun 23, 2:10 am)
Re: [PATCH RFC] reduce runqueue lock contention, Frank Rowand, (Wed Dec 1, 4:13 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Frank Rowand, (Wed Dec 1, 6:17 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Peter Zijlstra, (Thu Dec 2, 12:36 am)
Re: [PATCH RFC] reduce runqueue lock contention, Frank Rowand, (Mon Dec 13, 7:41 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Mike Galbraith, (Mon Dec 13, 8:42 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Frank Rowand, (Tue Dec 14, 2:42 pm)
Re: [PATCH RFC] reduce runqueue lock contention, Oleg Nesterov, (Wed Dec 15, 11:59 am)