]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/ext: Remove sched_fork() hack
authorThomas Gleixner <tglx@linutronix.de>
Mon, 28 Oct 2024 13:20:35 +0000 (14:20 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Nov 2024 11:55:37 +0000 (12:55 +0100)
Instead of solving the underlying problem of the double invocation of
__sched_fork() for idle tasks, sched-ext decided to hack around the issue
by partially clearing out the entity struct to preserve the already
enqueued node. A provided analysis and solution has been ignored for four
months.

Now that someone else has taken care of cleaning it up, remove the
disgusting hack and clear out the full structure. Remove the comment in the
structure declaration as well, as there is no requirement for @node being
the last element anymore.

Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/87ldy82wkc.ffs@tglx
include/linux/sched/ext.h
kernel/sched/ext.c

index 1ddbde64a31b4a233b8cd48fdd4971c18102575b..2799e7284fff72cba179d3592b7bb766e4610651 100644 (file)
@@ -199,7 +199,6 @@ struct sched_ext_entity {
 #ifdef CONFIG_EXT_GROUP_SCHED
        struct cgroup           *cgrp_moving_from;
 #endif
-       /* must be the last field, see init_scx_entity() */
        struct list_head        tasks_node;
 };
 
index 5900b06fd0364c76bcca9a37e9ad9e76082b8560..f6e9a14042d51c9113a4e3eadb79ae5805fb6a40 100644 (file)
@@ -3548,12 +3548,7 @@ static void scx_ops_exit_task(struct task_struct *p)
 
 void init_scx_entity(struct sched_ext_entity *scx)
 {
-       /*
-        * init_idle() calls this function again after fork sequence is
-        * complete. Don't touch ->tasks_node as it's already linked.
-        */
-       memset(scx, 0, offsetof(struct sched_ext_entity, tasks_node));
-
+       memset(scx, 0, sizeof(*scx));
        INIT_LIST_HEAD(&scx->dsq_list.node);
        RB_CLEAR_NODE(&scx->dsq_priq);
        scx->sticky_cpu = -1;