[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160307094852.GA6356@twins.programming.kicks-ass.net>
Date: Mon, 7 Mar 2016 10:48:52 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Chris Metcalf <cmetcalf@...lanox.com>
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
Russell King <linux@....linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Andrew Morton <akpm@...l.org>,
linux-kernel@...r.kernel.org, Aaron Tomlin <atomlin@...hat.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: Re: [PATCH 2/4] nmi_backtrace: generate one-line reports for idle
cpus
On Tue, Mar 01, 2016 at 11:01:42AM -0500, Chris Metcalf wrote:
> +++ b/kernel/sched/idle.c
> @@ -52,15 +52,25 @@ static int __init cpu_idle_nopoll_setup(char *__unused)
> __setup("hlt", cpu_idle_nopoll_setup);
> #endif
> +static DEFINE_PER_CPU(bool, cpu_idling);
> +
> +/* Was the cpu was in the low-level idle code when interrupted? */
> +bool in_cpu_idle(void)
> +{
> + return this_cpu_read(cpu_idling);
> +}
> +
> static inline int cpu_idle_poll(void)
> {
> rcu_idle_enter();
> trace_cpu_idle_rcuidle(0, smp_processor_id());
> local_irq_enable();
> stop_critical_timings();
> + this_cpu_write(cpu_idling, true);
> while (!tif_need_resched() &&
> (cpu_idle_force_poll || tick_check_broadcast_expired()))
> cpu_relax();
> + this_cpu_write(cpu_idling, false);
> start_critical_timings();
> trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
> rcu_idle_exit();
> @@ -89,7 +99,9 @@ void default_idle_call(void)
> local_irq_enable();
> } else {
> stop_critical_timings();
> + this_cpu_write(cpu_idling, true);
> arch_cpu_idle();
> + this_cpu_write(cpu_idling, false);
> start_critical_timings();
> }
> }
No, we're not going to add random crap here. This is actually considered
a fast path for some workloads.
There's already far too much fat in the whole going to idle and coming
out of idle. We should be trimming this, not adding to it.
Powered by blists - more mailing lists