[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201008123544.GX2628@hirez.programming.kicks-ass.net>
Date: Thu, 8 Oct 2020 14:35:44 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Marcelo Tosatti <mtosatti@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Frederic Weisbecker <frederic@...nel.org>,
Nitesh Narayan Lal <nitesh@...hat.com>,
Peter Xu <peterx@...hat.com>, Oleg Nesterov <oleg@...hat.com>
Subject: Re: [patch 2/2] nohz: change signal tick dependency to wakeup CPUs
of member tasks
On Wed, Oct 07, 2020 at 03:01:53PM -0300, Marcelo Tosatti wrote:
> Rather than waking up all nohz_full CPUs on the system, only wakeup
> the target CPUs of member threads of the signal.
>
> Reduces interruptions to nohz_full CPUs.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@...hat.com>
>
> Index: linux-2.6/kernel/time/tick-sched.c
> ===================================================================
> --- linux-2.6.orig/kernel/time/tick-sched.c
> +++ linux-2.6/kernel/time/tick-sched.c
> @@ -398,7 +398,15 @@ EXPORT_SYMBOL_GPL(tick_nohz_dep_clear_ta
> */
> void tick_nohz_dep_set_signal(struct signal_struct *sig, enum tick_dep_bits bit)
> {
> - tick_nohz_dep_set_all(&sig->tick_dep_mask, bit);
> + int prev;
> +
> + prev = atomic_fetch_or(BIT(bit), &sig->tick_dep_mask);
> + if (!prev) {
> + rcu_read_lock();
> + for_each_thread(sig, t)
> + tick_nohz_kick_task(t);
> + rcu_read_unlock();
> + }
> }
AFAICT, and this makes perfect sense, this function is only ever used
while holding sighand->siglock, which makes the RCU read lock
superfluous.
Would it make sense to change the signal_struct argument to task_struct,
such that we can write:
lockdep_assert_held(&p->sighand->siglock);
for_each_thread(p->signal, t)
tick_nohz_kick_task(t);
?
Powered by blists - more mailing lists