Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754722AbbHXNu3 (ORCPT ); Mon, 24 Aug 2015 09:50:29 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:33794 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbbHXNu2 (ORCPT ); Mon, 24 Aug 2015 09:50:28 -0400 X-Helo: d03dlp03.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Mon, 24 Aug 2015 06:50:18 -0700 From: "Paul E. McKenney" To: Ingo Molnar Cc: Frederic Weisbecker , Peter Zijlstra , LKML , Vatika Harlalka , Chris Metcalf , Thomas Gleixner , Preeti U Murthy , Christoph Lameter Subject: Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Message-ID: <20150824135018.GE11078@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1439516774-4614-1-git-send-email-fweisbec@gmail.com> <20150823054032.GA28133@gmail.com> <20150823160101.GA11078@linux.vnet.ibm.com> <20150824064412.GA11581@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150824064412.GA11581@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082413-0009-0000-0000-00000D7E2C2A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2288 Lines: 62 On Mon, Aug 24, 2015 at 08:44:12AM +0200, Ingo Molnar wrote: > > * Paul E. McKenney wrote: > > > > here it's fully set - triggering the bug I'm worried about. So what am I > > > missing, what prevents CONFIG_NO_HZ_FULL_ALL from crashing? > > > > The boot CPU is excluded from tick_nohz_full_mask in tick_nohz_init(), which is > > called from tick_init() which is called from start_kernel() shortly after > > rcu_init(): > > > > cpu = smp_processor_id(); > > > > if (cpumask_test_cpu(cpu, tick_nohz_full_mask)) { > > pr_warning("NO_HZ: Clearing %d from nohz_full range for timekeeping\n", cpu); > > cpumask_clear_cpu(cpu, tick_nohz_full_mask); > > } > > > > This happens after the call to tick_nohz_init_all() that does the > > cpumask_setall() that you called out above. > > Ah, indeed - I somehow missed that. > > This brings up two other questions: > > 1) > > the 'housekeeping CPU' is essentially the boot CPU. Yet we dedicate a full mask to > it (housekeeping_mask - a variable mask to begin with) and recover the > housekeeping CPU via: > > + return cpumask_any_and(housekeeping_mask, cpu_online_mask); > > which can be pretty expensive, and which gets executed in two hotpaths: > > kernel/time/hrtimer.c: return &per_cpu(hrtimer_bases, get_nohz_timer_target()); > kernel/time/timer.c: return per_cpu_ptr(&tvec_bases, get_nohz_timer_target()); > > ... why not just use a single housekeeping_cpu which would be way faster to pass > down to the timer code? The housekeeping_cpu came later, but that does seem like a good optimization. > 2) > > What happens if the boot CPU is offlined? (under CONFIG_BOOTPARAM_HOTPLUG_CPU0=y) > > I don't see CPU hotplug callbacks fixing up the housekeeping_mask if the boot CPU > is offlined. The tick_nohz_cpu_down_callback() function does this, though in a less than obvious way. The tick_do_timer_cpu variable is the housekeeping CPU that is currently handling timing, and it is not permitted to go offline. Thanx, Paul -- 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/