Skip to content

Commit

Permalink
Merge tag 'sched-urgent-2025-03-21' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/tip

Pull scheduler fix from Ingo Molnar:
 "Revert a scheduler performance optimization that regressed other
  workloads"

* tag 'sched-urgent-2025-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "sched/core: Reduce cost of sched_move_task when config autogroup"
  • Loading branch information
Linus Torvalds committed Mar 21, 2025
2 parents b3ee1e4 + 76f970c commit cb90c8d
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -9016,7 +9016,7 @@ void sched_release_group(struct task_group *tg)
spin_unlock_irqrestore(&task_group_lock, flags);
}

static struct task_group *sched_get_task_group(struct task_struct *tsk)
static void sched_change_group(struct task_struct *tsk)
{
struct task_group *tg;

Expand All @@ -9028,13 +9028,7 @@ static struct task_group *sched_get_task_group(struct task_struct *tsk)
tg = container_of(task_css_check(tsk, cpu_cgrp_id, true),
struct task_group, css);
tg = autogroup_task_group(tsk, tg);

return tg;
}

static void sched_change_group(struct task_struct *tsk, struct task_group *group)
{
tsk->sched_task_group = group;
tsk->sched_task_group = tg;

#ifdef CONFIG_FAIR_GROUP_SCHED
if (tsk->sched_class->task_change_group)
Expand All @@ -9055,20 +9049,11 @@ void sched_move_task(struct task_struct *tsk, bool for_autogroup)
{
int queued, running, queue_flags =
DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
struct task_group *group;
struct rq *rq;

CLASS(task_rq_lock, rq_guard)(tsk);
rq = rq_guard.rq;

/*
* Esp. with SCHED_AUTOGROUP enabled it is possible to get superfluous
* group changes.
*/
group = sched_get_task_group(tsk);
if (group == tsk->sched_task_group)
return;

update_rq_clock(rq);

running = task_current_donor(rq, tsk);
Expand All @@ -9079,7 +9064,7 @@ void sched_move_task(struct task_struct *tsk, bool for_autogroup)
if (running)
put_prev_task(rq, tsk);

sched_change_group(tsk, group);
sched_change_group(tsk);
if (!for_autogroup)
scx_cgroup_move_task(tsk);

Expand Down

0 comments on commit cb90c8d

Please sign in to comment.