Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2148922ybx; Fri, 8 Nov 2019 00:20:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzlDWWLJMhlv8uEG9uQnhzUY2/YFxl8NPfQMJLlg2aYFono6pMuDP9iOt7NQulweNsXCUnV X-Received: by 2002:a17:906:8591:: with SMTP id v17mr7495017ejx.185.1573201215041; Fri, 08 Nov 2019 00:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573201215; cv=none; d=google.com; s=arc-20160816; b=lJt99QW2jpGnuvOxbDVn6aNVz8AJoHC4/KnAR7DuhNCUiAKHbBnc4AZanfOLawYd6n zcVKMviNfIJId48voXEJAeRRM3liq1iuKpy2PgA8fD8n4tqapuznBApPq4+RZDsKcN5F Ibwc8X1RV0nc0k2JaK3M7e2TM6brlNLzRcF0x2FkmaRQRSiHaGN139L3GStxoEmNT50R FyURiPMjgEZxuSaWVwtxIfrMY5VGjOlzaFDmh15bLQIGwD+mCirYN0gnflAcRNcQ8U26 UlGpZcNmFV7p4ouHVTMyC/1JYiKTfK4cbDES2ultT6pUNxB1M9fUZw3BrxBeCTTSsahq daLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=OWhrJuGG8I8MK3cBXJGxKE/Vl+p35G59zs3aVFZAFsY=; b=Qb2ppZnVOn2Q/PXChDHSqbYTbkcq9So9mA1bQ40ljF2UvXoiqejoQZYjhmq2QvWBW/ QA0cNRutgdlrKe8YIzeT9APeXpCN1+igzafNMiqyGco65l65qsaBVc6Fy4OAbGK5GLl8 FOfLSSp3Lv1EDn6swPKbvTOM+ZKgJIMDmUxhaabBBNEiCYNlGVQWEukvO0kkZEl8B4Tm tIJWMaL9Ooh+2hUs1a4q/3jyr+yv0Qumz5dmnHaf8x59SdGm1eUAvuhdKZ5WwN9Ddcyl FJarh4L3h3AsWAhf3/m+GhSAjBezu3YKOuYGxeRuS5oUzwn7nbrSsQqV0VvSjul2+Cu5 rgGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UrYB+Fht; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a61si3826142edf.157.2019.11.08.00.19.51; Fri, 08 Nov 2019 00:20:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UrYB+Fht; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730632AbfKHIQL (ORCPT + 99 others); Fri, 8 Nov 2019 03:16:11 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28944 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729873AbfKHIQL (ORCPT ); Fri, 8 Nov 2019 03:16:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573200969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OWhrJuGG8I8MK3cBXJGxKE/Vl+p35G59zs3aVFZAFsY=; b=UrYB+FhtdL82XPBLtI8c6yNPFIR6yCIYzmukSI2drGAEOARdZHUIjUyCdTTTgu3f8/datX ovaW4iv0wVIE1ZOtqGeetBvFgcIKGVjzD1sJbBCR5p2zbwMSS0AyB8NYZzxvvdL7ss1LWc AyzqthhVBDMSPz4b3B/829i8RTKFNKc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-uy4gF92MPDWWLDxkCeCvWQ-1; Fri, 08 Nov 2019 03:16:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB72E1800DFB; Fri, 8 Nov 2019 08:16:04 +0000 (UTC) Received: from ovpn-116-229.phx2.redhat.com (ovpn-116-229.phx2.redhat.com [10.3.116.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 642F3271AF; Fri, 8 Nov 2019 08:16:04 +0000 (UTC) Message-ID: <37e46985b60839190f65c764da7c2eb2877d53b9.camel@redhat.com> Subject: Re: [PATCH] timers/nohz: Update nohz load even if tick already stopped From: Scott Wood To: Thomas Gleixner Cc: Peter Zijlstra , Frederic Weisbecker , Ingo Molnar , LKML Date: Fri, 08 Nov 2019 02:16:03 -0600 In-Reply-To: References: <20191028150716.22890-1-frederic@kernel.org> <20191029100506.GJ4114@hirez.programming.kicks-ass.net> <52d963553deda810113accd8d69b6dffdb37144f.camel@redhat.com> <20191030133130.GY4097@hirez.programming.kicks-ass.net> <813ed21938aa47b15f35f8834ffd98ad4dd27771.camel@redhat.com> <7b782bc880a29eb7d37f2c2aff73c43e7f7d032f.camel@redhat.com> Organization: Red Hat User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: uy4gF92MPDWWLDxkCeCvWQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-11-05 at 10:53 +0100, Thomas Gleixner wrote: > On Tue, 5 Nov 2019, Scott Wood wrote: > > On Tue, 2019-11-05 at 00:43 +0100, Thomas Gleixner wrote: > > > As Peter pointed out to me privately we should rather go and analyze > > > the > > > real thing instead of just applying duct tape. > > >=20 > > > /me drops the patch again. > >=20 > > The warning is due to kernel/sched/idle.c not updating curr- > > >se.exec_start. > >=20 > > While debugging I noticed an issue with a particular load pattern. The > > CPU > > goes non-nohz for a brief time at an interval very close to twice=20 > > tick_period. When the tick is started, the timer expiration is more > > than > > tick_period in the past, so hrtimer_forward() tries to catch up by > > adding > > 2*tick_period to the expiration. Then the tick is stopped before that > > new > > expiration, and when the tick is woken up the expiry is again advanced > > by > > 2*tick_period with the timer never actually > > running. sched_tick_remote() > > does fire every second, but there are streaks of several seconds where > > it > > keeps catching the CPU in a non-nohz state, so neither the normal nor > > remote > > ticks are calling calc_load_nohz_remote(). > >=20 > > Is there a reason to not just remove the hrtimer_forward() from > > tick_nohz_restart(), letting the timer fire if it's in the past, which > > will > > take care of doing hrtimer_forward()? >=20 > Well, no. tick_nohz_restart() can be invoked in a situation where the > timer > is armed for something in the far future (or completelt disabled) due to > previously entering an estimated long idle (or user space execution on > NOHZ_FULL) period. >=20 > That means if the timer is not canceled, realigned to the current tick an= d > forwarded to the next due tick, the tick will not fire on time causing > another sort of trouble. That might be true of the expiry on entering tick_nohz_restart(), but it shouldn't be true of ts->last_tick which the expiry is set to before callin= g hrtimer_forward() -- and if it were, hrtimer_forward() is a no-op when the expiry is in the future. BTW, the name "last_tick" seems misleading as it's actually the saved expiry, not the last time the tick ran. -Scott