From nobody Mon Feb 9 01:46:30 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 77698C7EE24 for ; Tue, 6 Jun 2023 14:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238377AbjFFOlO (ORCPT ); Tue, 6 Jun 2023 10:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238384AbjFFOj7 (ORCPT ); Tue, 6 Jun 2023 10:39:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BF811FFC for ; Tue, 6 Jun 2023 07:38:44 -0700 (PDT) Message-ID: <20230606142032.710699683@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686062287; 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=tGjZhkMVQyRr4XnKiVSbNfTqylPySohR9BvGVWy+/yU=; b=Js0F1AHEaIizBcWa7NPJK4AlSsrHSTctCJtwd7EXPcaUDu6Iw0MFE4A2cVWrts6eEMwuLg F0D+hYNNMgqX6YW61nxInrcWTjNchojQ0rjcHf/BWCmOdcvOiQv3hN763kS6Win12saETu v4bxvCeUQkEe0talgjedYqgUHMqzQvVorHTMwki7YpcRa2qXLZyI7d/qkfQ89IbnjWs3Og FGXLTAUUbYTYdE42MXg5P0RzT1CekezHUrsHZmXWPgcI6ALGDtnVzhrL9fUMzrjPi+gCcf /slyhGEhuzLxSk33oQ9jbmqf+Kfmfdwv4plghTsCMlyw0VtxgEjEAguNo90zRg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686062287; 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=tGjZhkMVQyRr4XnKiVSbNfTqylPySohR9BvGVWy+/yU=; b=4JlCTJy514LpWzmZGXVL9Qe2KOlRSWplLy8k9tNqv1tE/OCU7Bc0O3PvAhCBFshCffOYrT MeXFQfA9/r/LRqBA== 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 30/45] posix-cpu-timers: Use dedicated flag for CPU timer nanosleep References: <20230606132949.068951363@linutronix.de> MIME-Version: 1.0 Date: Tue, 6 Jun 2023 16:38:06 +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" POSIX CPU timer nanosleep creates a k_itimer on stack and uses the sigq pointer to detect the nanosleep case in the expiry function. Prepare for embedding sigqueue into struct k_itimer by using a dedicated flag for nanosleep. Signed-off-by: Thomas Gleixner --- include/linux/posix-timers.h | 4 +++- kernel/time/posix-cpu-timers.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -66,6 +66,7 @@ static inline int clockid_to_fd(const cl * @pid: Pointer to target task PID * @elist: List head for the expiry list * @firing: Timer is currently firing + * @nanosleep: Timer is used for nanosleep and is not a regular posix-timer * @handling: Pointer to the task which handles expiry */ struct cpu_timer { @@ -73,7 +74,8 @@ struct cpu_timer { struct timerqueue_head *head; struct pid *pid; struct list_head elist; - int firing; + bool firing; + bool nanosleep; struct task_struct __rcu *handling; }; =20 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -586,7 +586,7 @@ static void cpu_timer_fire(struct k_itim { struct cpu_timer *ctmr =3D &timer->it.cpu; =20 - if (unlikely(timer->sigq =3D=3D NULL)) { + if (unlikely(ctmr->nanosleep)) { /* * This a special case for clock_nanosleep, * not a normal timer from sys_timer_create. @@ -1471,6 +1471,7 @@ static int do_cpu_nanosleep(const clocki timer.it_overrun =3D -1; error =3D posix_cpu_timer_create(&timer); timer.it_process =3D current; + timer.it.cpu.nanosleep =3D true; =20 if (!error) { static struct itimerspec64 zero_it;