Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1276605 > unrolled thread

Re: [PATCH 2/7] nohz: New tick dependency mask

Started byChris Metcalf <cmetcalf@ezchip.com>
First post2015-11-24 17:20 +0100
Last post2015-11-25 12:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/7] nohz: New tick dependency mask Chris Metcalf <cmetcalf@ezchip.com> - 2015-11-24 17:20 +0100
    Re: [PATCH 2/7] nohz: New tick dependency mask Frederic Weisbecker <fweisbec@gmail.com> - 2015-11-25 12:40 +0100

#1276605 — Re: [PATCH 2/7] nohz: New tick dependency mask

FromChris Metcalf <cmetcalf@ezchip.com>
Date2015-11-24 17:20 +0100
SubjectRe: [PATCH 2/7] nohz: New tick dependency mask
Message-ID<qyotX-21n-11@gated-at.bofh.it>
On 11/13/2015 09:22 AM, 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.
>
> This new dependency engine stays beside the old one until all subsystems
> having a tick dependency are converted to it.
>
>
> +void tick_nohz_set_dep_cpu(enum tick_dependency_bit bit, int cpu)
> +{
> +	unsigned long prev;
> +	struct tick_sched *ts;
> +
> +	ts = per_cpu_ptr(&tick_cpu_sched, cpu);
> +
> +	prev = fetch_or(&ts->tick_dependency, BIT_MASK(bit));
> +	if (!prev) {
> +		preempt_disable();
> +		/* Perf needs local kick that is NMI safe */
> +		if (cpu == smp_processor_id()) {
> +			tick_nohz_full_kick();
> +		} else {
> +			/* Remote irq work not NMI-safe */
> +			WARN_ON_ONCE(in_nmi());

Better to say "if (!WARN_ON_ONCE(in_nmi()))" here instead so
we don't actually try to kick if we are in an NMI?

-- 
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com

--
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/

[toc] | [next] | [standalone]


#1277267

FromFrederic Weisbecker <fweisbec@gmail.com>
Date2015-11-25 12:40 +0100
Message-ID<qyGAz-5Fi-45@gated-at.bofh.it>
In reply to#1276605
On Tue, Nov 24, 2015 at 11:19:15AM -0500, Chris Metcalf wrote:
> On 11/13/2015 09:22 AM, 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.
> >
> >This new dependency engine stays beside the old one until all subsystems
> >having a tick dependency are converted to it.
> >
> >
> >+void tick_nohz_set_dep_cpu(enum tick_dependency_bit bit, int cpu)
> >+{
> >+	unsigned long prev;
> >+	struct tick_sched *ts;
> >+
> >+	ts = per_cpu_ptr(&tick_cpu_sched, cpu);
> >+
> >+	prev = fetch_or(&ts->tick_dependency, BIT_MASK(bit));
> >+	if (!prev) {
> >+		preempt_disable();
> >+		/* Perf needs local kick that is NMI safe */
> >+		if (cpu == smp_processor_id()) {
> >+			tick_nohz_full_kick();
> >+		} else {
> >+			/* Remote irq work not NMI-safe */
> >+			WARN_ON_ONCE(in_nmi());
> 
> Better to say "if (!WARN_ON_ONCE(in_nmi()))" here instead so
> we don't actually try to kick if we are in an NMI?

Makes sense yeah. I'll fix that.

Thanks.
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web