Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp271144rdb; Mon, 22 Jan 2024 03:52:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEee03Np10UWi3nUX9RfFbQ9Bt7K6nU0MVZVkUG84ajkyhu7YFUkP3PAQHdFyOrYHShKTYv X-Received: by 2002:a05:622a:64a:b0:42a:383b:419b with SMTP id a10-20020a05622a064a00b0042a383b419bmr3447112qtb.77.1705924358857; Mon, 22 Jan 2024 03:52:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705924358; cv=pass; d=google.com; s=arc-20160816; b=RCGWTMcz2Kaa5W9h8LP7bSxkCcaaxWjdpe2EJ6gzFRlJ6bF8UsDcf+yLY6P1NUCAcx Z5hdvGTVdEiegxNU1vc6Fldftp8C0cOJSFrZ91bXf1yLTkMdrdI/8LwALeKuS9QOURKj pdBrxfRLQ00ZnK4CMWnIrUx+eBcWCkO/mwYWxNJRecfq+Odeww6wabjDnfT45+cCm3SC W30Wi6h067FFcjZwXXSzfcRWP/v99pjinhUbiMo5IOTdcGbgFWGjrB21Ts+6YtEovACf mmW8zsFyho0NvD/+ruNbNwG9qa7wUEYL34owO1wceCOaCHoX8cVnlLdkk8zzwD6Zl77X lauw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=3VgdieGJCxlgcQWaTHx81zlGlxh/6iVr3eJP1bpqPZE=; fh=0xiuIgYwmqWERslX8T7WXvksK/H3CzUuWu1+0FDLmHM=; b=E7j6eBi7MMYyLCIVYPlA7qar5BsVpSbc+MqrMKGTGN/Jd0gpIE2DhY7UNXBmP6cIwi sJWyiE7e/aAedE3NhjubW0JbC/6x25LtH9NTD9cCuL9o/0DvYludvFPjDhdKPSuCK56q hCpbzapUDFSF67GLvRqrQNuijfhJef8mQcp7Ts07yIxJiQXoqiVGbZInda/t1DK+EVf3 JfQX3/mm9RZyl9G7y1sHcCh9aLS6TtY1Znmz2kmODuL4nTLiuoZPmj1Yai4Q4bk9qtkI rztc+gOh6deqMAj83PSr+RWC7JeQcjNoS1zyDwKjCFgjFYEXC6Ow9wDJR4puWJOg5XI1 0J4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QAKmCH0p; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-32964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32964-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c12-20020a05620a200c00b007836c741182si5295302qka.226.2024.01.22.03.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:52:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QAKmCH0p; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-32964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32964-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2E9691C2626C for ; Mon, 22 Jan 2024 11:50:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48A313D38F; Mon, 22 Jan 2024 11:48:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QAKmCH0p"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v5cYCC9l" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02B943D387 for ; Mon, 22 Jan 2024 11:48:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705924106; cv=none; b=tGI5n0V6KAvyb9wy71qbeNTWqi//SPNkQoIIFSWB9xmYCQkKKRrz5UupL7U6UK9OPBdo7s/7uu0nA0JUrTETwNmQ3IiWfxNqvdwHA90VTUeKJHK7aDOJJc2NPmcrAgDmkIfXDV76Z9XMf7I/r6hFo6dkL/mR/C07WZ52TQ6vPfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705924106; c=relaxed/simple; bh=+DYkNum4FEIFLopYuEl9D6wPk7Ngk7HY80Bzudp9b0A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=MTY+0tyKTtTPqKehFRirCatsNXKpb2hH57D9CIN59EMET8ZlQ7Osl/AEY3+Sv7FG60d+TZnSOi4g/KUsRlcZfqWdq/MmI2ELACB+0HeylelkykmMEZcSUrpBVjupM6+Lzr+J2NFzoKo1BFqTE3D8m4KpXhCzzUufAw73c1y0ab0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QAKmCH0p; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v5cYCC9l; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705924102; 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=3VgdieGJCxlgcQWaTHx81zlGlxh/6iVr3eJP1bpqPZE=; b=QAKmCH0poI8LxrvzNB976I5PJB8adJ5N5RsEbXUdJnr6YcWTofVXvPTYnGFz43wHyCOr9C bgvqJLG6scBNfMKbZysqOeukECe20G8AF9mG/bbL6mL/TUoV3Q43eZhUp/ouNawngXFZcZ gXaJhgYYkDCwhk0uKSHfHhTVeZ0bm44KFohvOQ2XiMrx2Rs1vIWovB0ykaXmHT9XNrGAfF /trrRcU/er9bK5loH2e5wpPezKdcJsl66MF+YvgFZDDQ92jhdQBHaKC4TmLj76DHz7yK2+ 5xlxW4aS0ge8Lytx+t5Pmn6ZlVfYu10tTk8zsWFSnQUbNHnjF3Wuzn1Yi7dMDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705924102; 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=3VgdieGJCxlgcQWaTHx81zlGlxh/6iVr3eJP1bpqPZE=; b=v5cYCC9lcpffaWEqhTxYQGSM2IXpfzywR+MsN3EHRHHUFWOqg9erS/c7bOQGImM2FuvOYJ rXprFrro6gY28PBw== To: Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , 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 v10 04/20] timers: Optimization for timer_base_try_to_set_idle() In-Reply-To: References: <20240115143743.27827-1-anna-maria@linutronix.de> <20240115143743.27827-5-anna-maria@linutronix.de> Date: Mon, 22 Jan 2024 12:48:21 +0100 Message-ID: <87r0i9y4fu.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Frederic Weisbecker writes: > Le Mon, Jan 15, 2024 at 03:37:27PM +0100, Anna-Maria Behnsen a =C3=A9crit= : >> 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 >> tick_nohz_next_event() call which was executed before >> tick_nohz_stop_tick(). >>=20 >> Signed-off-by: Anna-Maria Behnsen >> --- >> kernel/time/tick-sched.c | 2 +- >> kernel/time/timer.c | 11 ++++++++--- >> 2 files changed, 9 insertions(+), 4 deletions(-) >>=20 >> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c >> index c6223afc801f..27f1a2ae7f39 100644 >> --- a/kernel/time/tick-sched.c >> +++ b/kernel/time/tick-sched.c >> @@ -886,7 +886,7 @@ static void tick_nohz_stop_tick(struct tick_sched *t= s, int cpu) >> struct clock_event_device *dev =3D __this_cpu_read(tick_cpu_device.evt= dev); >> unsigned long basejiff =3D ts->last_jiffies; >> u64 basemono =3D ts->timer_expires_base; >> - bool timer_idle; >> + bool timer_idle =3D ts->tick_stopped; >> u64 expires; >>=20=20 >> /* Make sure we won't be trying to stop it twice in a row. */ >> diff --git a/kernel/time/timer.c b/kernel/time/timer.c >> index 3a668060692e..2f69a485a070 100644 >> --- a/kernel/time/timer.c >> +++ b/kernel/time/timer.c >> @@ -1999,13 +1999,18 @@ u64 get_next_timer_interrupt(unsigned long basej= , u64 basem) >> * timer_base_try_to_set_idle() - Try to set the idle state of the time= r bases >> * @basej: base time jiffies >> * @basem: base time clock monotonic >> - * @idle: pointer to store the value of timer_base->is_idle >> + * @idle: pointer to store the value of timer_base->is_idle on return; >> + * *idle contains the information whether tick was already stopped >> * >> - * Returns the tick aligned clock monotonic time of the next pending >> - * timer or KTIME_MAX if no timer is pending. >> + * Returns the tick aligned clock monotonic time of the next pending ti= mer or >> + * KTIME_MAX if no timer is pending. When tick was already stopped KTIM= E_MAX is >> + * returned as well. >> */ >> u64 timer_base_try_to_set_idle(unsigned long basej, u64 basem, bool *id= le) >> { >> + if (*idle) >> + return KTIME_MAX; > > Ok now I see the reason behind the behavioural change. > > So either: > > * We remove the old behaviour consisting in clearing base->is_idle if the= new > next timer is within a jiffy while the tick is stopped. But then the ch= angelog > from the previous patch should state that and comments must be clarifie= d. > I would like to take 'either'. I thought the changelog already mentioned it. But maybe I have to make it more explicit. I'll go and rework the comments once more. Thanks, Anna-Maria