From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934465AbbDWNHq (ORCPT ); Thu, 23 Apr 2015 09:07:46 -0400 Received: from www.linutronix.de ([62.245.132.108]:37478 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932206AbbDWNHo (ORCPT ); Thu, 23 Apr 2015 09:07:44 -0400 Date: Thu, 23 Apr 2015 15:07:59 +0200 (CEST) From: Thomas Gleixner To: Frederic Weisbecker cc: LKML , Peter Zijlstra , Ingo Molnar , Preeti U Murthy , Viresh Kumar , Marcelo Tosatti , John Stultz , Marcelo Tosatti Subject: Re: [patch 18/39] tick: sched: Force tick interrupt and get rid of softirq magic In-Reply-To: <20150423114704.GA22800@lerouge> Message-ID: References: <20150414203303.702062272@linutronix.de> <20150414203502.023464878@linutronix.de> <20150422142213.GA16832@lerouge> <20150423114704.GA22800@lerouge> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Apr 2015, Frederic Weisbecker wrote: > On Wed, Apr 22, 2015 at 04:32:11PM +0200, Thomas Gleixner wrote: > > On Wed, 22 Apr 2015, Frederic Weisbecker wrote: > > > But the reprogramming happens only under "if ((long)delta_jiffies >= 1)". > > > Probably this condition should go away as well. > > > > Errm. > > > > if (!ts->tick_stopped && delta_jiffies <= 1) > > goto out; > > > > So if the tick is NOT stopped and delta_jiffies <= 1 we let it tick > > and do nothing. > > > > if (delta_jiffies >= 1) > > Do the magic nohz stuff > > else > > tick_nohz_restart() > > > > We want the distinction here because if the tick IS stopped and the > > next event is due we need to kick it into gear again. So the condition > > needs to stay. It probably should be if (delta > 1), but that's a > > different story. > > Yes but what if the tick is stopped already and delta_jiffies < 1? Say the > tick was last programmed to fire in 5 seconds. An irq fires and enqueues > a timer to fire now. If it's soon enough that delta_jiffies < 1, it seems > we are missing the clock reprogramming and even the softirq from that irq exit. > > Because we have: > > if (!ts->tick_stopped && delta_jiffies <= 1) > goto out; > > if ((long)delta_jiffies >= 1) { > //do clock reprogramming or restart > ... > } > > - raise_softirq(TIMER_SOFTIRQ); Did you actually read what I wrote? > > if (delta_jiffies >= 1) > > Do the magic nohz stuff > > else > > tick_nohz_restart() So if ticked is stopped AND delta < 1 we call tick_nohz_restart(). Which will programm the tick for the next possible period to expire. Which will kick the timer softirq and expire the timer. Thanks, tglx