Messages in this thread | | | Date | Tue, 21 Apr 2015 17:26:00 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches |
| |
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?
> + read_unlock(&tasklist_lock); > + > + initialized = true; > }
| |