Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752514AbbDCRT5 (ORCPT ); Fri, 3 Apr 2015 13:19:57 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:34659 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbbDCRTz (ORCPT ); Fri, 3 Apr 2015 13:19:55 -0400 Date: Fri, 3 Apr 2015 19:19:48 +0200 From: Frederic Weisbecker To: Oleg Nesterov Cc: LKML , Peter Zijlstra , Dave Jones , Thomas Gleixner , "Paul E . McKenney" , Ingo Molnar , Rik van Riel Subject: Re: [PATCH 2/3] context_tracking: Inherit TIF_NOHZ through forks instead of context switches Message-ID: <20150403171946.GA13598@lerouge> References: <1427996365-12101-1-git-send-email-fweisbec@gmail.com> <1427996365-12101-3-git-send-email-fweisbec@gmail.com> <20150402180803.GA20608@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150402180803.GA20608@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1730 Lines: 56 On Thu, Apr 02, 2015 at 08:08:03PM +0200, Oleg Nesterov wrote: > On 04/02, Frederic Weisbecker wrote: > > > > +void context_tracking_cpu_set(int cpu) > > { > > - clear_tsk_thread_flag(prev, TIF_NOHZ); > > - set_tsk_thread_flag(next, TIF_NOHZ); > > + static bool initialized = false; > > + struct task_struct *p, *t; > > + unsigned long flags; > > + > > + 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_irqsave(&tasklist_lock, flags); > > + for_each_process_thread(p, t) > > + set_tsk_thread_flag(t, TIF_NOHZ); > > + read_unlock_irqrestore(&tasklist_lock, flags); > > + > > + initialized = true; > > } > > Agreed, but _irqsave is not needed. read_lock(tasklist) should work > just fine. Indeed, that was just in case we get more callers but then if it happens, it's their responsibility to fix the callee. So I'll just change that. > > Any reason 3/3 comes as a separate change? I won't argue, just curious. Nope, I should fold them indeed. Thanks. > > Oleg. > -- 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/