lkml.org 
[lkml]   [2014]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] sched: Pull resched loop to __schedule() callers
From
On Sun, Dec 14, 2014 at 6:24 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> -need_resched:
> preempt_disable();
> cpu = smp_processor_id();
> rq = cpu_rq(cpu);
> @@ -2821,8 +2824,6 @@ need_resched:
> post_schedule(rq);
>
> sched_preempt_enable_no_resched();
> - if (need_resched())
> - goto need_resched;


So my suggestion was to move the
"preempt_disable()/enable_no_resched()" into the callers too.

Everybody already does that - except for "schedule()" itself. So that
would involve adding it here too:

> @@ -2842,7 +2843,9 @@ asmlinkage __visible void __sched schedule(void)
> struct task_struct *tsk = current;
>
> sched_submit_work(tsk);
> - __schedule();
> + do {
preempt_disable();
> + __schedule();
sched_preempt_enable_no_resched();
> + } while (need_resched());
> }

Hmm?

That would mean that we have one less preempt update in the
__sched_preempt() cases. If somebody cares about the preempt counter
value, we'd have to increemnt the preempt count add values too, ie do

__preempt_count_add(PREEMPT_ACTIVE+1);

there, but I'm not convicned anybody cares about the exact count.

As it is, you end up doing the preempt count things twice in the
__sched_preempt() case: first the PREEMPT_ACTIVE count, and then the
count inside __schedule().

Hmm?

Linus


\
 
 \ /
  Last update: 2014-12-15 04:21    [W:0.045 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site