Re: [RFC PATCH v2 4/5] softirq: Unify should_wakeup_ksoftirqd()

From: Peter Zijlstra
Date: Wed Sep 04 2024 - 08:15:36 EST


On Wed, Sep 04, 2024 at 11:12:22AM +0000, K Prateek Nayak wrote:

> @@ -118,14 +101,40 @@ EXPORT_PER_CPU_SYMBOL_GPL(hardirq_context);
> * the task which is in a softirq disabled section is preempted or blocks.
> */
> struct softirq_ctrl {
> +#ifdef CONFIG_PREEMPT_RT
> local_lock_t lock;
> +#endif
> int cnt;
> };
>
> -static DEFINE_PER_CPU(struct softirq_ctrl, softirq_ctrl) = {
> +static DEFINE_PER_CPU_ALIGNED(struct softirq_ctrl, softirq_ctrl) = {
> +#ifdef CONFIG_PREEMPT_RT
> .lock = INIT_LOCAL_LOCK(softirq_ctrl.lock),
> +#endif
> };

With the exception of CONFIG_DEBUG_LOCK_ALLOC (part of LOCKDEP)
local_lock_t is an empty structure when PREEMPT_RT=n.

That is to say, you can probably get by without those extra #ifdefs.