// SPDX-License-Identifier: GPL-2.0
/*
* BPF extensible scheduler class: Documentation/scheduler/sched-ext.rst
*
* Built-in idle CPU tracking policy.
*
* Copyright (c) 2022 Meta Platforms, Inc. and affiliates.
* Copyright (c) 2022 Tejun Heo <tj@kernel.org>
* Copyright (c) 2022 David Vernet <dvernet@meta.com>
* Copyright (c) 2024 Andrea Righi <arighi@nvidia.com>
*/
#include "ext_idle.h"
/* Enable/disable built-in idle CPU selection policy */
static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);
/* Enable/disable per-node idle cpumasks */
static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_per_node);
/* Enable/disable LLC aware optimizations */
static DEFINE_STATIC_KEY_FALSE(scx_selcpu_topo_llc);
/* Enable/disable NUMA aware optimizations */
static DEFINE_STATIC_KEY_FALSE(scx_selcpu_topo_numa);
/*
* cpumasks to track idle CPUs within each NUMA node.
*
* If SCX_OPS_BUILTIN_IDLE_PER_NODE is not enabled, a single global cpumask
* from is used to track all the idle CPUs in the system.
*/
struct scx_idle_cpus {
cpumask_var_t cpu;
cpumask_var_t smt;
};
/*
* Global host-wide idle cpumasks (used when SCX_OPS_BUILTIN_IDLE_PER_NODE
* is not enabled).
*/
static struct scx_idle_cpus scx_idle_global_masks;
/*
* Per-node idle cpumasks.
*/