Skip to content

Commit

Permalink
sched/ext: Remove sched_fork() hack
Browse files Browse the repository at this point in the history
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: f0e1a06 ("sched_ext: Implement BPF extensible scheduler class")
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Link: https://lore.kernel.org/r/87ldy82wkc.ffs@tglx
  • Loading branch information
KAGA-KOKO authored and Peter Zijlstra committed Nov 5, 2024
1 parent b23decf commit 0f0d1b8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion include/linux/sched/ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
7 changes: 1 addition & 6 deletions kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0f0d1b8

Please sign in to comment.