Commit 337d1b35 authored by Andrea Righi's avatar Andrea Righi Committed by Tejun Heo
Browse files

sched_ext: Move built-in idle CPU selection policy to a separate file



As ext.c is becoming quite large, move the idle CPU selection policy to
separate files (ext_idle.c / ext_idle.h) for better code readability.

Moreover, group together all the idle CPU selection kfunc's to the same
btf_kfunc_id_set block.

No functional changes, this is purely code reorganization.

Suggested-by: default avatarYury Norov <yury.norov@gmail.com>
Signed-off-by: default avatarAndrea Righi <arighi@nvidia.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 1626e5ef
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -21006,8 +21006,7 @@ S: Maintained
W:	https://github.com/sched-ext/scx
T:	git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
F:	include/linux/sched/ext.h
F:	kernel/sched/ext.h
F:	kernel/sched/ext.c
F:	kernel/sched/ext*
F:	tools/sched_ext/
F:	tools/testing/selftests/sched_ext
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@

#ifdef CONFIG_SCHED_CLASS_EXT
# include "ext.c"
# include "ext_idle.c"
#endif

#include "syscalls.c"
+15 −724

File changed.

Preview size limit exceeded, changes collapsed.

+752 −0

File added.

Preview size limit exceeded, changes collapsed.

+39 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * BPF extensible scheduler class: Documentation/scheduler/sched-ext.rst
 *
 * 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>
 */
#ifndef _KERNEL_SCHED_EXT_IDLE_H
#define _KERNEL_SCHED_EXT_IDLE_H

extern struct static_key_false scx_builtin_idle_enabled;

#ifdef CONFIG_SMP
extern struct static_key_false scx_selcpu_topo_llc;
extern struct static_key_false scx_selcpu_topo_numa;

void scx_idle_update_selcpu_topology(void);
void scx_idle_reset_masks(void);
void scx_idle_init_masks(void);
bool scx_idle_test_and_clear_cpu(int cpu);
s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, u64 flags);
#else /* !CONFIG_SMP */
static inline void scx_idle_update_selcpu_topology(void) {}
static inline void scx_idle_reset_masks(void) {}
static inline void scx_idle_init_masks(void) {}
static inline bool scx_idle_test_and_clear_cpu(int cpu) { return false; }
static inline s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, u64 flags)
{
	return -EBUSY;
}
#endif /* CONFIG_SMP */

s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags, bool *found);

extern int scx_idle_init(void);

#endif /* _KERNEL_SCHED_EXT_IDLE_H */