From nobody Fri Dec 19 21:47:03 2025 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 5AB62481A0 for ; Wed, 10 Apr 2024 22:46:35 +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=1712789196; cv=none; b=kCs8NgRLjZ1V6PKFRBRJhdgMyZGyPP9GJewrhFZDHGcatWgsg5u2U7mxMKVgj5FS1E740GYpkYPul1vywGOqU1yYfZ8VKiTPn5Iaek0vDm1efrjkNhlbEIEu9TTWmRIJZjn1EoKff6w3Pmze6pnBjJ3azg86BRAMhoswsgXFOZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789196; c=relaxed/simple; bh=UGVZy9yiNtE3R/qqXfALDVUSsmVr1T6CsA5jtA7JuEI=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=tWr8JNooFS8YV6LXoi4U36qxerJIvDUu5XxKEPwfkhKEI6rvqd14lr1g33n8tkpaKzLZc+7AqfJeNje5K4cJsNtRVj3uc6qkJ1AD3qXjgvaDpWTaQ0TX7CE9o8hPCPDAblzTX41nPZLKFc4XrJM97mUmkwnP/EwEz3fcwqM5IhU= 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=to5uQCzb; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IKnaH5ee; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="to5uQCzb"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IKnaH5ee" Message-ID: <20240410165551.696591376@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789193; 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=IjZXK69CXPSZdDcaR3Lrs+m7BfPVp6Q5CnwMmPhWl8E=; b=to5uQCzbmFKdomBLmv3NP7ql54Ca08WkprguSTAXcy7Z0KV6QEETqqCuobT8Xe11Ejyd1V jjo6KdBnvCjhNgBPTOFlJqS1QpahiOJIwqGn9+CmhJTekx+J0wHF3SFi12JhYmsfeVSz3l Pc0uOBSbDNIn9sbBgPLGI9luIGcJqSzB0Md0I9r8xBIzANYwTKVuHdT1WuJwAtptbmWDEC h1U0/jeAuTH5o89FRsQAUkMMd2IfQgS5xY53Hs3z/UPoE0NtnZ+XjVPSiWkhtJ4wnqLlYJ sjuk8nVRRDki3quH+z9fjvOff0cwVGoerKO9JxhjmjJznJfsJqHDQAW07o5FnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789193; 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=IjZXK69CXPSZdDcaR3Lrs+m7BfPVp6Q5CnwMmPhWl8E=; b=IKnaH5eeEkqdTNKYcQVmE8boxuVc4upmvjSu73JY/z8bqDPen2BZJQU9tx4kfNsbJQhHII UlkVvYUW/cSK2aCA== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V2 12/50] posix-cpu-timers: Replace old expiry retrieval in posix_cpu_timer_set() References: <20240410164558.316665885@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 11 Apr 2024 00:46:33 +0200 (CEST) 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. No functional change. Signed-off-by: Thomas Gleixner Reviewed-by: Anna-Maria Behnsen --- V2: Adopted to previous changes --- kernel/time/posix-cpu-timers.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -614,6 +614,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. @@ -688,37 +690,11 @@ static int posix_cpu_timer_set(struct k_ else val =3D cpu_clock_sample_group(clkid, p, true); =20 + /* Retrieve the previous expiry value if requested. */ 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, val); - - if (val < exp) { - old_expires =3D exp - val; - old->it_value =3D ns_to_timespec64(old_expires); - } else { - /* - * A single shot SIGEV_NONE timer must return 0, when it is - * expired! Timers which have a real signal delivery mode - * must return a remaining time greater than 0 because the - * signal has not yet been delivered. - */ - if (sigev_none) - old->it_value.tv_nsec =3D 0; - else - old->it_value.tv_nsec =3D 1; - old->it_value.tv_sec =3D 0; - } - } + old->it_value =3D (struct timespec64){ }; + if (old_expires) + __posix_cpu_timer_get(timer, old, val); } =20 if (unlikely(ret)) {