Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281262
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Frederic Weisbecker <fweisbec@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/7] nohz: New tick dependency mask |
| Date | Tue, 01 Dec 2015 23:30:02 +0100 |
| Message-ID | <qB1AS-79P-5@gated-at.bofh.it> (permalink) |
| References | <qunwt-7y6-9@gated-at.bofh.it> <qunwt-7y6-7@gated-at.bofh.it> <qB027-65N-25@gated-at.bofh.it> |
| X-Original-To | Peter Zijlstra <peterz@infradead.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=gPhyrQvXQJlRsVYQEwq7eZM7eMC+bnH2+adO0auucys=; b=rNFZU29+M/cF0e9Ps/DEaZxmQpGL58Um3pFD9FdKW0b4izZ5EsTYyYTc5pzcTjlsd+ DsVfPzIZpg6u39bBSXMtl4r1nDfj3+uTac4mlJpe07JyMrBUfC10oKXQkZ1YDlDje3xA cpV9gGXx672u0CJDcsPBtELI3kQhtWy2Mqx6pauJ+dGZVGp3X63Dic0wdLOt+QS6WoI4 QXLwvyy/yLQLqDH1xmWB9tip7J5zeRBbg31GhTqgMZ6Pnhs+lEuX3zSzGxY/xTmhbGjM e7REuBS2ty48sr8siiptoeI6ghOcEM9/Hz+ESRdaUwkx7D/qeygtAzTftDKIdJSIA7/z fsqA== |
| X-Received | by 10.28.234.200 with SMTP id g69mr636458wmi.97.1449008431639; Tue, 01 Dec 2015 14:20:31 -0800 (PST) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 111 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | LKML <linux-kernel@vger.kernel.org>, Chris Metcalf <cmetcalf@ezchip.com>, Thomas Gleixner <tglx@linutronix.de>, Luiz Capitulino <lcapitulino@redhat.com>, Christoph Lameter <cl@linux.com>, Ingo Molnar <mingo@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>, Rik van Riel <riel@redhat.com> |
| X-Original-Date | Tue, 1 Dec 2015 23:20:28 +0100 |
| X-Original-Message-ID | <20151201222025.GA31973@lerouge> |
| X-Original-References | <1447424529-13671-1-git-send-email-fweisbec@gmail.com> <1447424529-13671-3-git-send-email-fweisbec@gmail.com> <20151201204109.GN17308@twins.programming.kicks-ass.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1281262 |
Show key headers only | View raw
On Tue, Dec 01, 2015 at 09:41:09PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 13, 2015 at 03:22:04PM +0100, Frederic Weisbecker wrote:
> > The tick dependency is evaluated on every IRQ. This is a batch of checks
> > which determine whether it is safe to stop the tick or not. These checks
> > are often split in many details: posix cpu timers, scheduler, sched clock,
> > perf events. Each of which are made of smaller details: posix cpu
> > timer involves checking process wide timers then thread wide timers. Perf
> > involves checking freq events then more per cpu details.
> >
> > Checking these details asynchronously every time we update the full
> > dynticks state bring avoidable overhead and a messy layout.
> >
> > Lets introduce instead tick dependency masks: one for system wide
> > dependency (unstable sched clock), one for CPU wide dependency (sched,
> > perf), and task/signal level dependencies. The subsystems are responsible
> > of setting and clearing their dependency through a set of APIs that will
> > take care of concurrent dependency mask modifications and kick targets
> > to restart the relevant CPU tick whenever needed.
>
> Maybe better explain why we need the per task and per signal thingy?
I'll detail that some more in the changelog. The only user of the per task/per signal
tick dependency is posix cpu timer. I've been first proposing a global tick dependency
as soon as any posix cpu timer is armed. It simplified everything but some reviewers
complained (eg: some users might want to run posix timers on housekeepers without
bothering full dynticks CPUs). I could remove the per signal dependency with dispatching
it through all threads in the group each time there is an update but that's the best I can
think of.
>
> > +static void trace_tick_dependency(unsigned long dep)
> > +{
> > + if (dep & TICK_POSIX_TIMER_MASK) {
> > + trace_tick_stop(0, "posix timers running\n");
> > + return;
> > + }
> > +
> > + if (dep & TICK_PERF_EVENTS_MASK) {
> > + trace_tick_stop(0, "perf events running\n");
> > + return;
> > + }
> > +
> > + if (dep & TICK_SCHED_MASK) {
> > + trace_tick_stop(0, "more than 1 task in runqueue\n");
> > + return;
> > + }
> > +
> > + if (dep & TICK_CLOCK_UNSTABLE_MASK)
> > + trace_tick_stop(0, "unstable sched clock\n");
> > +}
>
> I would suggest ditching the strings and using the
Using a code value instead?
>
> > +static void kick_all_work_fn(struct work_struct *work)
> > +{
> > + tick_nohz_full_kick_all();
> > +}
> > +static DECLARE_WORK(kick_all_work, kick_all_work_fn);
> > +
> > +void __tick_nohz_set_dep_delayed(enum tick_dependency_bit bit, unsigned long *dep)
> > +{
> > + unsigned long prev;
> > +
> > + prev = fetch_or(dep, BIT_MASK(bit));
> > + if (!prev) {
> > + /*
> > + * We need the IPIs to be sent from sane process context.
>
> Why ?
Because posix timers code is all called with interrupts disabled and we can't
send IPIs then.
>
> > + * The posix cpu timers are always set with irqs disabled.
> > + */
> > + schedule_work(&kick_all_work);
> > + }
> > +}
> > +
> > +/*
> > + * Set a global tick dependency. Lets do the wide IPI kick asynchronously
> > + * for callers with irqs disabled.
>
> This seems to suggest you can call this with IRQs disabled
Ah right, that's a misleading comment. We need to use the _delayed() version
when interrupts are disabled.
Thanks.
>
> > + */
> > +void tick_nohz_set_dep(enum tick_dependency_bit bit)
> > +{
> > + unsigned long prev;
> > +
> > + prev = fetch_or(&tick_dependency, BIT_MASK(bit));
> > + if (!prev)
> > + tick_nohz_full_kick_all();
>
> But that function seems implemented using smp_call_function_many() which
> cannot be called with IRQs disabled.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 2/7] nohz: New tick dependency mask Peter Zijlstra <peterz@infradead.org> - 2015-12-01 21:50 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-12-01 23:30 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Peter Zijlstra <peterz@infradead.org> - 2015-12-02 12:00 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-12-02 15:10 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Peter Zijlstra <peterz@infradead.org> - 2015-12-02 16:10 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-12-08 17:00 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Peter Zijlstra <peterz@infradead.org> - 2015-12-02 13:50 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-12-02 15:20 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Peter Zijlstra <peterz@infradead.org> - 2015-12-02 13:50 +0100
Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-12-02 15:20 +0100
csiph-web