From nobody Mon Feb 9 15:27:15 2026 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 18BCDC77B7A for ; Tue, 6 Jun 2023 14:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238023AbjFFOiT (ORCPT ); Tue, 6 Jun 2023 10:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238012AbjFFOh6 (ORCPT ); Tue, 6 Jun 2023 10:37:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE6F10E0 for ; Tue, 6 Jun 2023 07:37:41 -0700 (PDT) Message-ID: <20230606142031.761271959@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686062259; 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: references:references; bh=ob/W6MhzxScgyFPIMc+gvNg8o5xjqBQZWBN/IorB7bE=; b=SCvoCkSp2EBNPlg9q940g+JrZP6pzFOgz7FFTWpU46jD5cHmKxKnhMZjnbZ9xoPZCpn3ae FVI578SMgJamC3rLpuuE0d9oufWTkLhmu/h29m2mbczYj9XIo0jczpnqU4XebflDkC2Fdl xI7TfXR/VSOru+FfjXi95UcYj6t8ucuEJeBkHeGzzET9MmOCCDx9JdYA7BDNvIE1ufK3gL hZU043m7L2kxkfuozb1a5r3cYXeS0+IorFh837i9kxsGH85T+cx/k6J/lQxkF5kkaE8McZ T36BXvfzeE6X7FZpYYioGrJE1f7S/Ffhxf5c98hWVriw05GhCegVxf2GeNks9w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686062259; 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: references:references; bh=ob/W6MhzxScgyFPIMc+gvNg8o5xjqBQZWBN/IorB7bE=; b=nQFBQ5ePLWCt0uAyyP09UUBBGlfIp/c+ObKLOPQeUWXRW/gOnELQ77dt6uEmoAQmjmauIu NfATje6SDz2RZGDQ== From: Thomas Gleixner To: LKML Cc: Frederic Weisbecker , Anna-Maria Behnsen , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch 13/45] posix-cpu-timers: Replace old expiry retrieval in posix_cpu_timer_set() References: <20230606132949.068951363@linutronix.de> MIME-Version: 1.0 Date: Tue, 6 Jun 2023 16:37:39 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reuse the split out __posix_cpu_timer_get() function which does already the right thing. Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- kernel/time/posix-cpu-timers.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -609,6 +609,8 @@ static void cpu_timer_fire(struct k_itim } } =20 +static void __posix_cpu_timer_get(struct k_itimer *timer, struct itimerspe= c64 *itp, u64 now); + /* * Guts of sys_timer_settime for CPU timers. * This is called with the timer locked and interrupts disabled. @@ -680,29 +682,9 @@ static int posix_cpu_timer_set(struct k_ else now =3D cpu_clock_sample_group(clkid, p, !sigev_none); =20 - if (old) { - if (old_expires =3D=3D 0) { - old->it_value.tv_sec =3D 0; - old->it_value.tv_nsec =3D 0; - } else { - /* - * Update the timer in case it has overrun already. - * If it has, we'll report it as having overrun and - * with the next reloaded timer already ticking, - * though we are swallowing that pending - * notification here to install the new setting. - */ - u64 exp =3D bump_cpu_timer(timer, now); - - if (now < exp) { - old_expires =3D exp - now; - old->it_value =3D ns_to_timespec64(old_expires); - } else { - old->it_value.tv_nsec =3D 1; - old->it_value.tv_sec =3D 0; - } - } - } + /* Retrieve the previous expiry value if requested. */ + if (old && old_expires) + __posix_cpu_timer_get(timer, old, now); =20 /* Retry if the timer expiry is running concurrently */ if (unlikely(ret)) {