Re: [RFC PATCH 6/7] preempt/dynamic: Provide irqentry_exit_cond_resched() static call

From: Peter Zijlstra
Date: Tue Nov 10 2020 - 05:32:31 EST


On Tue, Nov 10, 2020 at 01:56:08AM +0100, Frederic Weisbecker wrote:
> [convert from static key to static call, only define static call when
> PREEMPT_DYNAMIC]

> noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
> {
> @@ -383,8 +386,13 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
> }
>
> instrumentation_begin();
> - if (IS_ENABLED(CONFIG_PREEMPTION))
> + if (IS_ENABLED(CONFIG_PREEMPTION)) {
> +#ifdef CONFIG_PREEMT_DYNAMIC
> + static_call(irqentry_exit_cond_resched)();
> +#else
> irqentry_exit_cond_resched();
> +#endif
> + }
> /* Covers both tracing and lockdep */
> trace_hardirqs_on();
> instrumentation_end();

The reason I had this a static_branch() is that because if you look at
the code-gen of this function, you'll find it will inline the call.

Not sure it matters much, but it avoids a CALL+RET.