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

From: K Prateek Nayak
Date: Wed Sep 04 2024 - 09:41:15 EST


Hello Peter,

On 9/4/2024 5:45 PM, Peter Zijlstra wrote:
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.

Thank you for the suggestion. I'll drop those extra #ifdefs in the next
version.
--
Thanks and Regards,
Prateek