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


Groups > linux.kernel > #1622333

Re: [RFC][PATCH] sched: Have do_idle() call __schedule() without enabling preemption

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH] sched: Have do_idle() call __schedule() without enabling preemption
Date 2017-04-12 18:50 +0200
Message-ID <tvtCX-6Qp-31@gated-at.bofh.it> (permalink)
References <tvgw2-7e1-1@gated-at.bofh.it> <tvrKO-5EQ-25@gated-at.bofh.it> <tvtjA-6IX-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 12 Apr 2017 18:21:57 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> On Wed, Apr 12, 2017 at 10:41:24AM -0400, Steven Rostedt wrote:
> > [ tl;dr; version ]
> > 
> > Peter, In order to have synchronize_rcu_tasks() work, the idle task can
> > never be preempted. There's a very small window in
> > schedule_preempt_disable() that enables preemption, and when this
> > happens, it breaks synchronize_rcu_tasks() (see above email for
> > details).
> > 
> > Is there any reason to enable preemption, or can we simply have idle
> > call into schedule without ever allowing it to be preempted, as in my
> > patch?  
> 
> Dunno,.. this changelog should convince me, not make me do the work :-)

I didn't want you to do any work. I was wondering if you knew of any
reason. But looking into the history of the do_idle() function and
schedule_preempt_disable(), I don't see any reason. I'll post another
patch with a better change log.

> 
> > Note, it is almost good enough to just change
> > schedule_preempt_disable() to do the exact same thing, but there's one
> > instance in kernel/locking/mutex.c that calls it in a non running state.  
> 
> The point being that that must not happen because of
> sched_submit_work(), which, for idle, should not matter.

Right, and also for all the other cases that call
schedule_preempt_disable() which includes init/main.c and another
location in mutex.c that sets the task state to TASK_RUNNING just
before calling it.

But the one case where it can be something other than TASK_RUNNING,
then we need to keep the current method.

OK, I think it is fine for the idle task to never enable preemption and
I'll post a better change log patch.

Thanks!

-- Steve

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


Thread

[RFC][PATCH] sched: Have do_idle() call __schedule() without  enabling preemption Steven Rostedt <rostedt@goodmis.org> - 2017-04-12 04:50 +0200
  Re: [RFC][PATCH] sched: Have do_idle() call __schedule() without  enabling preemption Steven Rostedt <rostedt@goodmis.org> - 2017-04-12 16:50 +0200
    Re: [RFC][PATCH] sched: Have do_idle() call __schedule() without  enabling preemption Peter Zijlstra <peterz@infradead.org> - 2017-04-12 18:30 +0200
      Re: [RFC][PATCH] sched: Have do_idle() call __schedule() without  enabling preemption Steven Rostedt <rostedt@goodmis.org> - 2017-04-12 18:50 +0200

csiph-web