]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - include/linux/tick.h
tick/nohz: Evaluate the CPU expression after the static key
[mirror_ubuntu-jammy-kernel.git] / include / linux / tick.h
index 7340613c7eff7ad791634c76ae2ecd547f711c45..2258984a0e8a79b57e83a0738df971c8110e9fa8 100644 (file)
@@ -185,13 +185,17 @@ static inline bool tick_nohz_full_enabled(void)
        return tick_nohz_full_running;
 }
 
-static inline bool tick_nohz_full_cpu(int cpu)
-{
-       if (!tick_nohz_full_enabled())
-               return false;
-
-       return cpumask_test_cpu(cpu, tick_nohz_full_mask);
-}
+/*
+ * Check if a CPU is part of the nohz_full subset. Arrange for evaluating
+ * the cpu expression (typically smp_processor_id()) _after_ the static
+ * key.
+ */
+#define tick_nohz_full_cpu(_cpu) ({                                    \
+       bool __ret = false;                                             \
+       if (tick_nohz_full_enabled())                                   \
+               __ret = cpumask_test_cpu((_cpu), tick_nohz_full_mask);  \
+       __ret;                                                          \
+})
 
 static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask)
 {