From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C1CCD80B0 for ; Tue, 10 Oct 2023 11:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231499AbjJJLs7 (ORCPT ); Tue, 10 Oct 2023 07:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231544AbjJJLsz (ORCPT ); Tue, 10 Oct 2023 07:48:55 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8553AF for ; Tue, 10 Oct 2023 04:48:51 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696938530; 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: in-reply-to:in-reply-to:references:references; bh=LfxZBEaYn9pBAe6XWAS9KebgnYIvRu1sv+X/+uTWueg=; b=ZWNv7GZKzbYXdt6lssHdKCH5piVwvUymFVtkFKCxg9rji7zYA307pKVfr+nEiEiGuBBqkH oRvS7zWK0ORN2NW7CgP6X3TBvyx2cwwpEg9OpcoUiLV7c1AZE2v1paBhJrwjK8a6bx0ZtX b+iC1CdEOMT+1nNEzJSTg9g5Fy560dsqOp1u+7VZQH+5ZNPzY1+JEDB8+gY+iKx9hl3Eo2 wJAel8dnCe5lkYjpztD1uYsw2EbWj6QJjwGiSJSI2+jFQuGt9FjUUEYVfuoN28+pHCrTNr rIYN0NtLAmb52P1mZjMurrk3h8t+SRPmsXu02qs9FWQCph6O+k3j+pqmmDFgBw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696938530; 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: in-reply-to:in-reply-to:references:references; bh=LfxZBEaYn9pBAe6XWAS9KebgnYIvRu1sv+X/+uTWueg=; b=L0aokBJ43Oe/L8fp8CFXJrEYOuX6XUYP9GNtPuncRWwxZgVHpn785SsTe7vJq1k9elQLtz 28ELNrTO29KYegAQ== To: Frederic Weisbecker Cc: Anna-Maria Behnsen , linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v8 08/25] timer: Rework idle logic In-Reply-To: References: <20231004123454.15691-1-anna-maria@linutronix.de> <20231004123454.15691-9-anna-maria@linutronix.de> <878r8bphn6.ffs@tglx> Date: Tue, 10 Oct 2023 13:48:50 +0200 Message-ID: <87ttqyofz1.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 10 2023 at 13:19, Frederic Weisbecker wrote: > On Tue, Oct 10, 2023 at 12:15:09AM +0200, Thomas Gleixner wrote: >> > + base->is_idle = time_after(nextevt, basej + 1); >> >> This is wrongly ordered. base->is_idle must be updated _after_ >> evaluating base->timers_pending because the below can change nextevt, >> no? >> >> > + if (base->timers_pending) { >> > + /* If we missed a tick already, force 0 delta */ >> > + if (time_before(nextevt, basej)) >> > + nextevt = basej; >> > + expires = basem + (u64)(nextevt - basej) * TICK_NSEC; > > I suspect it doesn't matter in pratice: base->is_idle will remain false > if it's before/equal jiffies. > > Still it hurts the eyes so I agree the re-ordering should happen here and > this will even simplify a bit the next patch. Right. Anna-Maria just pointed that out to me before, but we are all in violent agreement that it sucks :)