[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150402180803.GA20608@redhat.com>
Date: Thu, 2 Apr 2015 20:08:03 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dave Jones <davej@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 2/3] context_tracking: Inherit TIF_NOHZ through forks
instead of context switches
On 04/02, Frederic Weisbecker wrote:
>
> +void context_tracking_cpu_set(int cpu)
> {
> - clear_tsk_thread_flag(prev, TIF_NOHZ);
> - set_tsk_thread_flag(next, TIF_NOHZ);
> + static bool initialized = false;
> + struct task_struct *p, *t;
> + unsigned long flags;
> +
> + if (!per_cpu(context_tracking.active, cpu)) {
> + per_cpu(context_tracking.active, cpu) = true;
> + static_key_slow_inc(&context_tracking_enabled);
> + }
> +
> + if (initialized)
> + return;
> +
> + set_tsk_thread_flag(&init_task, TIF_NOHZ);
> +
> + /*
> + * There shouldn't be any thread at this early boot stage
> + * but the scheduler is ready to host any. So lets walk
> + * the tasklist just in case. tasklist_lock isn't necessary
> + * either that early but take it for correctness checkers.
> + */
> + read_lock_irqsave(&tasklist_lock, flags);
> + for_each_process_thread(p, t)
> + set_tsk_thread_flag(t, TIF_NOHZ);
> + read_unlock_irqrestore(&tasklist_lock, flags);
> +
> + initialized = true;
> }
Agreed, but _irqsave is not needed. read_lock(tasklist) should work
just fine.
Any reason 3/3 comes as a separate change? I won't argue, just curious.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists