lkml.org 
[lkml]   [2015]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches
On Tue, Apr 21, 2015 at 06:51:54PM +0200, Frederic Weisbecker wrote:
> On Tue, Apr 21, 2015 at 05:26:00PM +0200, Peter Zijlstra wrote:
> > On Tue, Apr 21, 2015 at 02:23:07PM +0200, Frederic Weisbecker wrote:
> > > +void __init context_tracking_cpu_set(int cpu)
> > > {
> > > + static __initdata bool initialized = false;
> > > + struct task_struct *p, *t;
> > > +
> > > + if (!per_cpu(context_tracking.active, cpu)) {
> > > + per_cpu(context_tracking.active, cpu) = true;
> > > + static_key_slow_inc(&context_tracking_enabled);
> > > + }
> > > +
> > > + if (initialized)
> > > + return;
> > > +
> > > + set_tsk_thread_flag(&init_task, TIF_NOHZ);
> > > +
> > > + /*
> > > + * There shouldn't be any thread at this early boot stage
> > > + * but the scheduler is ready to host any. So lets walk
> > > + * the tasklist just in case. tasklist_lock isn't necessary
> > > + * either that early but take it for correctness checkers.
> > > + */
> > > + read_lock(&tasklist_lock);
> > > + for_each_process_thread(p, t)
> > > + set_tsk_thread_flag(t, TIF_NOHZ);
> >
> > If there should not be any task, should there not be a WARN_ON_ONCE()
> > here?
>
> Well, it's legal to have a task at that time because sched_init() was called.
> I just haven't observed any task other than init/0. But future code (or alternate
> configs than mine) might create a task between sched_init() and tick_init(). And
> the above code takes care of such a possibility.

So why not do it sooner?


\
 
 \ /
  Last update: 2015-04-21 23:21    [W:0.313 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site