Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964854AbbDUUw2 (ORCPT ); Tue, 21 Apr 2015 16:52:28 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60989 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933039AbbDUUwZ (ORCPT ); Tue, 21 Apr 2015 16:52:25 -0400 Date: Tue, 21 Apr 2015 22:52:18 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: LKML , Mike Galbraith , Chris Metcalf , Ingo Molnar , Dave Jones , Thomas Gleixner , Oleg Nesterov , "Rafael J . Wysocki" , "Paul E . McKenney" , Ingo Molnar , Rik van Riel , Martin Schwidefsky Subject: Re: [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches Message-ID: <20150421205218.GB2898@worktop.Skamania.guest> References: <1429618989-11104-1-git-send-email-fweisbec@gmail.com> <1429618989-11104-3-git-send-email-fweisbec@gmail.com> <20150421152600.GE3182@worktop.meeting.verilan.com> <20150421165152.GA10289@lerouge> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150421165152.GA10289@lerouge> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1723 Lines: 42 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? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/