Commit 70d837c3 authored by Tejun Heo's avatar Tejun Heo
Browse files

sched_ext: Merge branch 'sched/core' of...

sched_ext: Merge branch 'sched/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

 into for-6.19

Pull in tip/sched/core to receive:

 50653216 ("sched: Add support to pick functions to take rf")
 4c953807 ("sched/ext: Fold balance_scx() into pick_task_scx()")

which will enable clean integration of DL server support among other things.

This conflicts with the following from sched_ext/for-6.18-fixes:

 a8ad8731 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")

which adds maybe_queue_balance_callback() to balance_scx() which is removed
by 50653216. Resolve by moving the invocation to pick_task_scx() in the
equivalent location.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parents 075e3f72 73cbcfe2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -325,4 +325,6 @@ static inline void freq_invariance_set_perf_ratio(u64 ratio, bool turbo_disabled
extern void arch_scale_freq_tick(void);
#define arch_scale_freq_tick arch_scale_freq_tick

extern int arch_sched_node_distance(int from, int to);

#endif /* _ASM_X86_TOPOLOGY_H */
+70 −0
Original line number Diff line number Diff line
@@ -515,6 +515,76 @@ static void __init build_sched_topology(void)
	set_sched_topology(topology);
}

#ifdef CONFIG_NUMA
static int sched_avg_remote_distance;
static int avg_remote_numa_distance(void)
{
	int i, j;
	int distance, nr_remote, total_distance;

	if (sched_avg_remote_distance > 0)
		return sched_avg_remote_distance;

	nr_remote = 0;
	total_distance = 0;
	for_each_node_state(i, N_CPU) {
		for_each_node_state(j, N_CPU) {
			distance = node_distance(i, j);

			if (distance >= REMOTE_DISTANCE) {
				nr_remote++;
				total_distance += distance;
			}
		}
	}
	if (nr_remote)
		sched_avg_remote_distance = total_distance / nr_remote;
	else
		sched_avg_remote_distance = REMOTE_DISTANCE;

	return sched_avg_remote_distance;
}

int arch_sched_node_distance(int from, int to)
{
	int d = node_distance(from, to);

	switch (boot_cpu_data.x86_vfm) {
	case INTEL_GRANITERAPIDS_X:
	case INTEL_ATOM_DARKMONT_X:

		if (!x86_has_numa_in_package || topology_max_packages() == 1 ||
		    d < REMOTE_DISTANCE)
			return d;

		/*
		 * With SNC enabled, there could be too many levels of remote
		 * NUMA node distances, creating NUMA domain levels
		 * including local nodes and partial remote nodes.
		 *
		 * Trim finer distance tuning for NUMA nodes in remote package
		 * for the purpose of building sched domains. Group NUMA nodes
		 * in the remote package in the same sched group.
		 * Simplify NUMA domains and avoid extra NUMA levels including
		 * different remote NUMA nodes and local nodes.
		 *
		 * GNR and CWF don't expect systems with more than 2 packages
		 * and more than 2 hops between packages. Single average remote
		 * distance won't be appropriate if there are more than 2
		 * packages as average distance to different remote packages
		 * could be different.
		 */
		WARN_ONCE(topology_max_packages() > 2,
			  "sched: Expect only up to 2 packages for GNR or CWF, "
			  "but saw %d packages when building sched domains.",
			  topology_max_packages());

		d = avg_remote_numa_distance();
	}
	return d;
}
#endif /* CONFIG_NUMA */

void set_cpu_sibling_map(int cpu)
{
	bool has_smt = __max_threads_per_core > 1;
+5 −0
Original line number Diff line number Diff line
@@ -340,6 +340,11 @@ _label: \
#define __DEFINE_CLASS_IS_CONDITIONAL(_name, _is_cond)	\
static __maybe_unused const bool class_##_name##_is_conditional = _is_cond

#define DEFINE_CLASS_IS_UNCONDITIONAL(_name)		\
	__DEFINE_CLASS_IS_CONDITIONAL(_name, false);	\
	static inline void * class_##_name##_lock_ptr(class_##_name##_t *_T) \
	{ return (void *)1; }

#define __GUARD_IS_ERR(_ptr)                                       \
	({                                                         \
		unsigned long _rc = (__force unsigned long)(_ptr); \
+4 −7
Original line number Diff line number Diff line
@@ -637,8 +637,8 @@ struct sched_rt_entity {
#endif
} __randomize_layout;

typedef bool (*dl_server_has_tasks_f)(struct sched_dl_entity *);
typedef struct task_struct *(*dl_server_pick_f)(struct sched_dl_entity *);
struct rq_flags;
typedef struct task_struct *(*dl_server_pick_f)(struct sched_dl_entity *, struct rq_flags *rf);

struct sched_dl_entity {
	struct rb_node			rb_node;
@@ -730,9 +730,6 @@ struct sched_dl_entity {
	 * dl_server_update().
	 *
	 * @rq the runqueue this server is for
	 *
	 * @server_has_tasks() returns true if @server_pick return a
	 * runnable task.
	 */
	struct rq			*rq;
	dl_server_pick_f		server_pick_task;
@@ -1861,8 +1858,8 @@ extern int task_can_attach(struct task_struct *p);
extern int dl_bw_alloc(int cpu, u64 dl_bw);
extern void dl_bw_free(int cpu, u64 dl_bw);

/* do_set_cpus_allowed() - consider using set_cpus_allowed_ptr() instead */
extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask);
/* set_cpus_allowed_force() - consider using set_cpus_allowed_ptr() instead */
extern void set_cpus_allowed_force(struct task_struct *p, const struct cpumask *new_mask);

/**
 * set_cpus_allowed_ptr - set CPU affinity mask of a task
+1 −1
Original line number Diff line number Diff line
@@ -4180,7 +4180,7 @@ bool cpuset_cpus_allowed_fallback(struct task_struct *tsk)
	rcu_read_lock();
	cs_mask = task_cs(tsk)->cpus_allowed;
	if (is_in_v2_mode() && cpumask_subset(cs_mask, possible_mask)) {
		do_set_cpus_allowed(tsk, cs_mask);
		set_cpus_allowed_force(tsk, cs_mask);
		changed = true;
	}
	rcu_read_unlock();
Loading