#endif /* CONFIG_NUMA_BALANCING */
}
+DEFINE_STATIC_KEY_FALSE(sched_numa_balancing);
+
#ifdef CONFIG_NUMA_BALANCING
-__read_mostly bool sched_numa_balancing;
void set_numabalancing_state(bool enabled)
{
- sched_numa_balancing = enabled;
+ if (enabled)
+ static_branch_enable(&sched_numa_balancing);
+ else
+ static_branch_disable(&sched_numa_balancing);
}
#ifdef CONFIG_PROC_SYSCTL
{
struct ctl_table t;
int err;
- int state = sched_numa_balancing;
+ int state = static_branch_likely(&sched_numa_balancing);
if (write && !capable(CAP_SYS_ADMIN))
return -EPERM;
int local = !!(flags & TNF_FAULT_LOCAL);
int priv;
- if (!sched_numa_balancing)
+ if (!static_branch_likely(&sched_numa_balancing))
return;
/* for example, ksmd faulting in a user's mm */
unsigned long src_faults, dst_faults;
int src_nid, dst_nid;
- if (!sched_numa_balancing)
+ if (!static_branch_likely(&sched_numa_balancing))
return -1;
if (!p->numa_faults || !(env->sd->flags & SD_NUMA))
entity_tick(cfs_rq, se, queued);
}
- if (sched_numa_balancing)
+ if (!static_branch_unlikely(&sched_numa_balancing))
task_tick_numa(rq, curr);
}
#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
#endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */
-#ifdef CONFIG_NUMA_BALANCING
-extern bool sched_numa_balancing;
-#else
-#define sched_numa_balancing (0)
-#endif /* CONFIG_NUMA_BALANCING */
+extern struct static_key_false sched_numa_balancing;
static inline u64 global_rt_period(void)
{