Re: [RFC 1/3] softirq: Use preempt_latency_stop/start to trace preemption

From: Peter Zijlstra
Date: Wed May 29 2019 - 04:34:16 EST


On Tue, May 28, 2019 at 05:16:22PM +0200, Daniel Bristot de Oliveira wrote:
> prempt_disable/enable tracepoints occurs only in the preemption
> enabled <-> disable transition. As preempt_latency_stop() and
> preempt_latency_start() already do this control, avoid code
> duplication by using these functions in the softirq code as well.
>
> RFC: Should we move preempt_latency_start/preempt_latency_stop
> to a trace source file... or even a header?

Yeah, a header might not be a bad idea.

> @@ -130,12 +132,8 @@ void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
> trace_softirqs_off(ip);
> raw_local_irq_restore(flags);
>
> - if (preempt_count() == cnt) {
> -#ifdef CONFIG_DEBUG_PREEMPT
> - current->preempt_disable_ip = get_lock_parent_ip();
> -#endif
> - trace_preempt_off(CALLER_ADDR0, get_lock_parent_ip());
> - }
> + preempt_latency_start(cnt);
> +

I'm thinking we can do without that empty line.

> }
> EXPORT_SYMBOL(__local_bh_disable_ip);
> #endif /* CONFIG_TRACE_IRQFLAGS */