• Tejun Heo's avatar
    sched: Factor out cgroup weight conversion functions · 4f9c7ca8
    Tejun Heo authored
    Factor out sched_weight_from/to_cgroup() which convert between scheduler
    shares and cgroup weight. No functional change. The factored out functions
    will be used by a new BPF extensible sched_class so that the weights can be
    exposed to the BPF programs in a way which is consistent cgroup weights and
    easier to interpret.
    
    The weight conversions will be used regardless of cgroup usage. It's just
    borrowing the cgroup weight range as it's more intuitive.
    CGROUP_WEIGHT_MIN/DFL/MAX constants are moved outside CONFIG_CGROUPS so that
    the conversion helpers can always be defined.
    
    v2: The helpers are now defined regardless of COFNIG_CGROUPS.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarDavid Vernet <dvernet@meta.com>
    Acked-by: default avatarJosh Don <joshdon@google.com>
    Acked-by: default avatarHao Luo <haoluo@google.com>
    Acked-by: default avatarBarret Rhoden <brho@google.com>
    4f9c7ca8
core.c 266 KB