From nobody Sun Nov 24 16:29:21 2024 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 F3F302003B6 for ; Tue, 5 Nov 2024 08:14:43 +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=1730794485; cv=none; b=KlcemzuF9ra1T28tyIL4SXQotnqX+MkxKuygCQ5ziRAc+gskLlAI8eMevnwTj4HIgaZsh7S0HJDNpqjoaXZ2zcGBaB4sjNR5R72GuohiYCEWE+e1k2Sm/gMVciczSBLjHTS+brParkworKc++dpCkCPiV93m4MNG9LOwxlY1fS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730794485; c=relaxed/simple; bh=kiTXtVgw+U1qnp5FhuoXzBaBFn74/QO2mlup5NmMvn0=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=piRfMj5jqFbgDs6yrEHxjGuOizM70z6cXyqY6Tc3l9qm+3gJBx8hZ2r/bn1tBdlrLfMj6D28t8Tt1yl2jyiDuV65Ga0riZBBySSUC+mdBf9ttn0E9hkjg10yMaLacQO0sDhLUr5a2Zvu4EJrJ2ZhAVKX33fLJVdDx1DIDGD5nW4= 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=YnKll0YT; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JKyXRUSI; 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="YnKll0YT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JKyXRUSI" Message-ID: <20241105064213.519086500@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730794481; 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=gXCAblQOBPavs913jzKws+IyhhY6pcRYmrxp+julPVw=; b=YnKll0YTnDQ23LLLBjf0jUKNE8e+Pl6V/BPM3Jmz2yWb3ZfMa/B4QnwAh5T+fj0BV7+W2G a7XK0Ku8cLcdvgVMPB2Ll9DsfUxFxEY7QOEfH4K/aOI1PBDIvooogY6k5Vhtcornkpi0rM JpWc2w6YlFKX+1rszLh9rf2GZCxSozTbEFGw5v/stsqgzIqkdhVTfcbWyeoFXEmN4/jO7m UP++KQ0fcW9bLhU6E2hFteH2clqOiPOrW3Qft/11Mx/dOMqvI8rfJM2VFHHJav+deGYKpK 3XYLYeVToGNSOZdcVEwnJNit0iILvO/ffRmcPrAbXGErN22R8zME5gv9Io5Y0w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730794481; 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=gXCAblQOBPavs913jzKws+IyhhY6pcRYmrxp+julPVw=; b=JKyXRUSImoE+YuH/QfobX7j/xJUFJiJIs1ZN+ftZ0dHPysqy+0vPNafqLdRzFgEwjyQIgn 7ben3vLAuh6MjQBg== 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 V7 09/21] posix-timers: Store PID type in the timer References: <20241105063544.565410398@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 5 Nov 2024 09:14:41 +0100 (CET) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" instead of re-evaluating the signal delivery mode everywhere. Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Acked-by: Peter Zijlstra (Intel) --- include/linux/posix-timers.h | 2 ++ kernel/time/posix-timers.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) --- --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -180,6 +181,7 @@ struct k_itimer { s64 it_overrun_last; unsigned int it_signal_seq; int it_sigev_notify; + enum pid_type it_pid_type; ktime_t it_interval; struct signal_struct *it_signal; union { --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -298,7 +298,6 @@ bool posixtimer_deliver_signal(struct ke int posix_timer_queue_signal(struct k_itimer *timr) { enum posix_timer_state state =3D POSIX_TIMER_DISARMED; - enum pid_type type; int ret; =20 lockdep_assert_held(&timr->it_lock); @@ -308,8 +307,7 @@ int posix_timer_queue_signal(struct k_it =20 timr->it_status =3D state; =20 - type =3D !(timr->it_sigev_notify & SIGEV_THREAD_ID) ? PIDTYPE_TGID : PIDT= YPE_PID; - ret =3D send_sigqueue(timr->sigq, timr->it_pid, type, timr->it_signal_seq= ); + ret =3D send_sigqueue(timr->sigq, timr->it_pid, timr->it_pid_type, timr->= it_signal_seq); /* If we failed to send the signal the timer stops. */ return ret > 0; } @@ -496,6 +494,11 @@ static int do_timer_create(clockid_t whi new_timer->it_pid =3D get_pid(task_tgid(current)); } =20 + if (new_timer->it_sigev_notify & SIGEV_THREAD_ID) + new_timer->it_pid_type =3D PIDTYPE_PID; + else + new_timer->it_pid_type =3D PIDTYPE_TGID; + new_timer->sigq->info.si_tid =3D new_timer->it_id; new_timer->sigq->info.si_code =3D SI_TIMER;