Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp65174lqg; Wed, 10 Apr 2024 15:48:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJ9LECbCfondhvFiKF32m6jS0U+dyiuWNWkydxBxqaL2u19epIsxgzZb7b9Iv/tsZqIgQiPPsRhw/8uT8JwuTXqzNLmlwJCXo26IzNRA== X-Google-Smtp-Source: AGHT+IGoYVg7xirm3W9y2tGMyxxDeHqFciONimYexDoCnYUHQPk4sD71MoxxddyHASMSdzUjN739 X-Received: by 2002:a05:6870:fb91:b0:233:1027:af37 with SMTP id kv17-20020a056870fb9100b002331027af37mr3430959oab.45.1712789336242; Wed, 10 Apr 2024 15:48:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712789336; cv=pass; d=google.com; s=arc-20160816; b=Nj5qGeOB0qs8iNCFfNMHfW/Vg3LmolakvEADoJ9TNdxBp/whmBLiysn5Gb74jjydxN FxjXB7E93DcOESSqCvp81QJGC20jeivI2DZCc66DE1IP8kAaSp9SuyHWxPvSEIh9Wvos b3Mvy9u3Yct+ncvmsxW+jO0KCWnae74J4sjPTxGrv5r1aQRfXuw2AoYb1vXhKQ9cqn3U PDXWgmu+49MLJBDoH5+5xJopf+f4PN5diDdNxIWtpM7IMw1sLX7DpywrVzNv0gtBav9w SF3s1E/vUSII+Yj6B0rGWzFpL9l9yvdcgjdBUp+U42JdojaSKTRiscbSFV0N4OnASb8G mVQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=IjZXK69CXPSZdDcaR3Lrs+m7BfPVp6Q5CnwMmPhWl8E=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=Asa/R2i690wgO/8eze9/auEFe0FNs/Voe/Dzy4x6Ld8QvP/lNK7neq3TaMbXBU8wE9 Nc6TVV91GTzHSjiRfSx460rZYWWjf5ug1C1XGj5G3Blcm2JOYYKxSNCWGFwkE1GdcGGU CwGJNtrQwm7MJwFrlEl7sWlOHNW64cceC0JZA91vwQ8WdyeqkuX99EjrD3pWN4ZqT0f7 a66a8zs2+UdVpl0h3rQ8IZI4OvYWHBr8NYDB6L9AIzFOKBEf2kFavDdsVIBIhjVQhIxm bPSbcwQ/+01Nj8zL0iipNllxmzCNPaSg6OzUpDfqoqI2luZJdVhGTOY4DLSCuQko3BIZ qsXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=to5uQCzb; 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-139465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139465-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 b13-20020a05620a04ed00b0078d4e0d6d5bsi256402qkh.324.2024.04.10.15.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139465-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=to5uQCzb; 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-139465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139465-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 EB2D41C2194F for ; Wed, 10 Apr 2024 22:48:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFF7923BB; Wed, 10 Apr 2024 22:46:37 +0000 (UTC) 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" 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 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 Content-Type: text/plain; charset=UTF-8 Date: Thu, 11 Apr 2024 00:46:33 +0200 (CEST) Reuse the split out __posix_cpu_timer_get() function which does already the right thing. No functional change. Signed-off-by: Thomas Gleixner --- 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 } } +static void __posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec64 *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 = cpu_clock_sample_group(clkid, p, true); + /* Retrieve the previous expiry value if requested. */ if (old) { - if (old_expires == 0) { - old->it_value.tv_sec = 0; - old->it_value.tv_nsec = 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 = bump_cpu_timer(timer, val); - - if (val < exp) { - old_expires = exp - val; - old->it_value = 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 = 0; - else - old->it_value.tv_nsec = 1; - old->it_value.tv_sec = 0; - } - } + old->it_value = (struct timespec64){ }; + if (old_expires) + __posix_cpu_timer_get(timer, old, val); } if (unlikely(ret)) {