From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754826AbaDKKEZ (ORCPT ); Fri, 11 Apr 2014 06:04:25 -0400 Received: from mail-oa0-f52.google.com ([209.85.219.52]:33735 "EHLO mail-oa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbaDKKEX (ORCPT ); Fri, 11 Apr 2014 06:04:23 -0400 MIME-Version: 1.0 In-Reply-To: <20140410143857.GA27654@localhost.localdomain> References: <20140410143857.GA27654@localhost.localdomain> Date: Fri, 11 Apr 2014 15:34:23 +0530 Message-ID: Subject: Re: [Query]: tick-sched: why don't we stop tick when we are running idle task? From: Viresh Kumar To: Frederic Weisbecker Cc: Thomas Gleixner , Linux Kernel Mailing List , Lists linaro-kernel Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10 April 2014 20:09, Frederic Weisbecker wrote: > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index 9f8af69..1e2d6b7 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -202,13 +202,16 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now); > void __tick_nohz_full_check(void) > { > struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); > + unsigned long flags; > > + local_irq_save(flags); As we need to disable interrupts to read this variable, would it be better to just remove this completely and use is_idle_task(current) instead? > if (tick_nohz_full_cpu(smp_processor_id())) { > - if (ts->tick_stopped && !is_idle_task(current)) { > + if (ts->tick_stopped && !ts->inidle)) { > if (!can_stop_full_tick()) > tick_nohz_restart_sched_tick(ts, ktime_get()); > } > } > + local_irq_restore(flags); > } > If you like it I'll push it to Ingo. Yes please. And thanks for the explanations. It was pretty useful. I am looking to offload 1 second tick to timekeeping CPUs and so going through these frameworks. I don't have a working solution yet (even partially :)). Would send a RFC to you as soon as I get anything working. -- viresh