Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp231258rdb; Tue, 5 Dec 2023 04:05:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfNnDXQ3iKhgLxzzZUUqEPhkckmwVv4y9CIaCEoiVXx9/AOGaIWwnYeUID63Ckc8CGTP9E X-Received: by 2002:a17:90a:6c24:b0:286:ab9d:c6be with SMTP id x33-20020a17090a6c2400b00286ab9dc6bemr1020603pjj.16.1701777959306; Tue, 05 Dec 2023 04:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701777958; cv=none; d=google.com; s=arc-20160816; b=W/dmD6RmDyfl/w7wasucbee5p3lDCFZeAqlILAnqBk8KKDM8s5OGvEdmsnuj+ph8ra 8T35nuGNuhb47WU+fKZmDliAQ4BGKBXj+JrHjgPGOByvN2odilBvlvXbvsVW3iq7o3kR 809ZLrdkynvMCQ8ubc7xbsT40eRkbmr8y5TA4bf0y1WEzQeRWO6FhnimGPAbYx5XjdOS yhjXC83D5y2RpQHgLqDnnwibSkeMfKHkGrNj2g+QXl0ShDULEODWiASqCqJeYGVm2a+c USYF98bZFmRIY/EIOOQkN+WR2K14NCx6CMd3y6u7d2qtY3PRnTBpNs6BaloGGRSIh4c+ Ek+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=N1r0rHwKvAq8UD1DxN9U58B4Dag1H1uArzbdH/NRW3o=; fh=zngDPpHc9IOT4XyfACYkaIQBkMO1o2QUewR15pJChdQ=; b=C1OgbWmtJ3JNeJVWorkybdbnoiLGniwvN2klVycZZS9gnM5l/weBn+eewovLBbvvwj Gx9AUgxtU/Ley/lsPyRmjHabSXCCb7NXm/Px5RNG2wq/kh1SFzM+/l3ChWndG7ZfxqAH 5P7M2bZ0Mwd+Mxui0wZd+EP/exdqTQETMWNfmDkgw8u38E28SnoIuNigepj/6H/wvdXe V+wX9oC37wPTK51pwAGOA2+O4N/eMjgjHKtrGqT624toT6KkZd4eUWDAJkRQNUu+7fO5 jcnwHo6eExJmUBdmgn7Hih3tlIcM9EqknjYRQX3SsuN8SmI/kngPbCklcTvoOWdawKoO msoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VX7Vooox; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p4bzjKta; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p2-20020a17090ab90200b002851727a227si4919535pjr.32.2023.12.05.04.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 04:05:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VX7Vooox; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p4bzjKta; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 094C48081CED; Tue, 5 Dec 2023 04:05:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442366AbjLEMFQ (ORCPT + 99 others); Tue, 5 Dec 2023 07:05:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442328AbjLEMFO (ORCPT ); Tue, 5 Dec 2023 07:05:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69F6C6 for ; Tue, 5 Dec 2023 04:05:20 -0800 (PST) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701777919; 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=N1r0rHwKvAq8UD1DxN9U58B4Dag1H1uArzbdH/NRW3o=; b=VX7Voooxsq2R3voHwJVgNJMqJepRmQQ/9IDQt10OUEMABb1eLcGc2ytSi88IiEsuuETRQG 0YUCyPJIMZxcJdPutdDQQo8zBYT0eeNG0G4Gpyhd3ceENkSaIn736g9lHr9FitX9x5QB6Z kd0Tw0dtY77rO7Aj2W2bqNQzNCW2nlLPvKsRk+Mmg2vOWnd16qTPiRq8Sfy1KJ0E4D7QtS 1AEObDzQq8BM0ypHt8XYMBznNVoXeU6S61NNukFASxKvSm5qQqMElkoWRi37EoF7R+p8j8 MgglAKOu/K5GMIjhvaYN4BoQBWSuHdnvNgSbw64T7RIZctLWa8+EOpok4gcuCg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701777919; 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=N1r0rHwKvAq8UD1DxN9U58B4Dag1H1uArzbdH/NRW3o=; b=p4bzjKtaiteYaGdKgzzXauZkiPgP5DhYywNrVjssQ+YvHsRC6VJzoje5zPT2G8Cf5tCs9O qrUkaFPc0IeabxBA== To: Sebastian Siewior Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v9 16/32] timers: Optimization for timer_base_try_to_set_idle() In-Reply-To: <20231204175246.J_8wNRQp@linutronix.de> References: <20231201092654.34614-1-anna-maria@linutronix.de> <20231201092654.34614-17-anna-maria@linutronix.de> <20231204175246.J_8wNRQp@linutronix.de> Date: Tue, 05 Dec 2023 13:05:18 +0100 Message-ID: <87wmtsdfcx.fsf@somnus> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 05 Dec 2023 04:05:33 -0800 (PST) Sebastian Siewior writes: > On 2023-12-01 10:26:38 [+0100], Anna-Maria Behnsen wrote: >> When tick is stopped also the timer base is_idle flag is set. When >> reentering the timer_base_try_to_set_idle() with the tick stopped, there is >> no need to check whether the timer base needs to be set idle again. When a >> timer was enqueued in the meantime, this is already handled by the >> nohz_get_next_event() call which was executed before tick_nohz_stop_tick(). > > as of #15 tick_stopped is set later in tick_nohz_stop_tick() and both > (tick_sched::tick_stopped and timer_base::is_idle) are cleared in > tick_nohz_restart_sched_tick(). > > Then we have tick_nohz_idle_retain_tick() with only one caller and is > only clearing timer_base::is_idle. Now, wouldn't it make sense to > preload timer_idle based on timer_base::is_idle? When revisting the code, this timer_clear_idle() is no longer required in tick_nohz_idle_retain_tick(). This is only called when the tick is not stopped - so timer base is not idle as well and this call is superfluous. As we keep both states in sync (tick_sched::tick_stopped and timer_base::is_idle) it doesn't matter which one is used. In tick_nohz_stop_tick() I don't have access to timer base. I could add it to timer_base_try_to_set_idle() but it will not make a difference. > I don't know if it there is a different outcome if timer_base::is_idle > gets cleared in the idle path vs tick_sched::tick_stopped. > I can't find nohz_get_next_event(). s/nohz_get_next_event/tick_nohz_next_event/ ... >> Signed-off-by: Anna-Maria Behnsen > > Sebastian Thanks, Anna-Maria