From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
Chris Metcalf <cmetcalf@ezchip.com>,
Ingo Molnar <mingo@kernel.org>, Dave Jones <davej@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@redhat.com>, Rik van Riel <riel@redhat.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches
Date: Tue, 21 Apr 2015 18:51:54 +0200 [thread overview]
Message-ID: <20150421165152.GA10289@lerouge> (raw)
In-Reply-To: <20150421152600.GE3182@worktop.meeting.verilan.com>
On Tue, Apr 21, 2015 at 05:26:00PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 21, 2015 at 02:23:07PM +0200, Frederic Weisbecker wrote:
> > +void __init context_tracking_cpu_set(int cpu)
> > {
> > + static __initdata bool initialized = false;
> > + struct task_struct *p, *t;
> > +
> > + 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(&tasklist_lock);
> > + for_each_process_thread(p, t)
> > + set_tsk_thread_flag(t, TIF_NOHZ);
>
> If there should not be any task, should there not be a WARN_ON_ONCE()
> here?
Well, it's legal to have a task at that time because sched_init() was called.
I just haven't observed any task other than init/0. But future code (or alternate
configs than mine) might create a task between sched_init() and tick_init(). And
the above code takes care of such a possibility.
>
> > + read_unlock(&tasklist_lock);
> > +
> > + initialized = true;
> > }
next prev parent reply other threads:[~2015-04-21 16:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 12:23 [PATCH 0/4] nohz: A few improvements v2 Frederic Weisbecker
2015-04-21 12:23 ` [PATCH 1/4] context_tracking: Protect against recursion Frederic Weisbecker
2015-04-21 12:23 ` [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches Frederic Weisbecker
2015-04-21 15:26 ` Peter Zijlstra
2015-04-21 16:51 ` Frederic Weisbecker [this message]
2015-04-21 20:52 ` Peter Zijlstra
2015-04-21 21:06 ` Frederic Weisbecker
2015-04-22 15:35 ` Peter Zijlstra
2015-04-22 15:51 ` Frederic Weisbecker
2015-04-21 12:23 ` [PATCH 3/4] nohz: Add tick_nohz_full_add_cpus_to() API Frederic Weisbecker
2015-04-21 12:23 ` [PATCH 4/4] nohz: Set isolcpus when nohz_full is set Frederic Weisbecker
2015-04-21 15:26 ` [PATCH 0/4] nohz: A few improvements v2 Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2015-04-24 15:58 [PATCH 0/4] nohz: A few improvements v3 Frederic Weisbecker
2015-04-24 15:58 ` [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches Frederic Weisbecker
2015-05-06 16:04 [GIT PULL] nohz: A few improvements v4 Frederic Weisbecker
2015-05-06 16:04 ` [PATCH 2/4] context_tracking: Inherit TIF_NOHZ through forks instead of context switches Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150421165152.GA10289@lerouge \
--to=fweisbec@gmail.com \
--cc=cmetcalf@ezchip.com \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=riel@redhat.com \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox