[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJq/KHqjChLWtypG@lothringen>
Date: Tue, 27 Jun 2023 12:51:20 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>,
John Stultz <jstultz@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Stephen Boyd <sboyd@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: [patch 12/45] posix-cpu-timers: Simplify posix_cpu_timer_set()
On Tue, Jun 06, 2023 at 04:37:37PM +0200, Thomas Gleixner wrote:
> Avoid the late sighand lock/unlock dance when a timer is not armed to
> enforce reevaluation of the timer base so that the process wide CPU timer
> sampling can be disabled.
>
> Do it right at the point where the arming decision is made which already
> has sighand locked.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> kernel/time/posix-cpu-timers.c | 38 +++++++++++++-------------------------
> 1 file changed, 13 insertions(+), 25 deletions(-)
>
> --- a/kernel/time/posix-cpu-timers.c
> +++ b/kernel/time/posix-cpu-timers.c
> @@ -720,10 +720,14 @@ static int posix_cpu_timer_set(struct k_
> /*
> * Arm the timer if it is not disabled, the new expiry value has
> * not yet expired and the timer requires signal delivery.
> - * SIGEV_NONE timers are never armed.
> + * SIGEV_NONE timers are never armed. In case the timer is not
> + * armed, enforce the reevaluation of the timer base so that the
> + * process wide cputime counter can be disabled eventually.
> */
> if (!sigev_none && new_expires && now < new_expires)
> arm_timer(timer, p);
> + else
> + trigger_base_recalc_expires(timer, p);
We don't need a recalc if sigev_none, right?
Thanks.
>
> unlock_task_sighand(p, &flags);
> /*
Powered by blists - more mailing lists