Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1212228

Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers

From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers
Date 2015-08-24 16:10 +0200
Message-ID <q10BJ-1vm-45@gated-at.bofh.it> (permalink)
References <pXci5-4fP-5@gated-at.bofh.it> <q0wkj-8c-3@gated-at.bofh.it> <q0G0h-5G2-1@gated-at.bofh.it> <q0TJU-8m0-9@gated-at.bofh.it> <q10s2-14H-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Aug 24, 2015 at 06:50:18AM -0700, Paul E. McKenney wrote:
> On Mon, Aug 24, 2015 at 08:44:12AM +0200, Ingo Molnar wrote:
> > 
> > * Paul E. McKenney <paulmck@linux.vnet.ibm.com> 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.

Well nohz full is likely to be used for HPC and that can involve big machines.
Having the housekeeping duty spread per node is a likely future evolution there,
if it isn't already used that way.

So we need to keep it a cpumask.

> 
> > 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.

Indeed, more specifically tick-common.c makes sure to set the timekeeping
duty to a housekeeper and that housekeeper is always the boot CPU due to
early device initialization.

But I should find a way to simplify that code and make it obvious it's always
set to the boot CPU.
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-23 07:50 +0200
  Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-08-23 18:10 +0200
    Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-24 03:30 +0200
    Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-24 08:50 +0200
      Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to  housekeepers Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-08-24 09:30 +0200
        Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-24 09:50 +0200
          Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to  housekeepers Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-08-24 10:00 +0200
            Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-24 10:10 +0200
      Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-24 15:40 +0200
        Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to  housekeepers Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-08-24 16:10 +0200
        Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-25 10:30 +0200
          Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-25 15:50 +0200
            Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Ingo Molnar <mingo@kernel.org> - 2015-08-28 10:40 +0200
              Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-28 14:40 +0200
      Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-08-24 16:00 +0200
        Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-24 16:10 +0200
          Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-08-24 17:50 +0200
  Re: [PATCH RESEND] sched/nohz: Affine unpinned timers to housekeepers Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-24 03:50 +0200

csiph-web