Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755425AbbDUP0O (ORCPT ); Tue, 21 Apr 2015 11:26:14 -0400 Received: from casper.infradead.org ([85.118.1.10]:45886 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbbDUP0K (ORCPT ); Tue, 21 Apr 2015 11:26:10 -0400 Date: Tue, 21 Apr 2015 17:26:00 +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: <20150421152600.GE3182@worktop.meeting.verilan.com> References: <1429618989-11104-1-git-send-email-fweisbec@gmail.com> <1429618989-11104-3-git-send-email-fweisbec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429618989-11104-3-git-send-email-fweisbec@gmail.com> 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: 1216 Lines: 38 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; > } -- 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/