Commit b5c09460 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'sched-urgent-2025-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fix from Ingo Molnar:
 "Fix a group-throttling bug in the fair scheduler"

* tag 'sched-urgent-2025-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Prevent cfs_rq from being unthrottled with zero runtime_remaining
parents 133262ca 956dfda6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9606,7 +9606,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg,

		guard(rq_lock_irq)(rq);
		cfs_rq->runtime_enabled = runtime_enabled;
		cfs_rq->runtime_remaining = 0;
		cfs_rq->runtime_remaining = 1;

		if (cfs_rq->throttled)
			unthrottle_cfs_rq(cfs_rq);
+6 −9
Original line number Diff line number Diff line
@@ -6024,20 +6024,17 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
	struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];

	/*
	 * It's possible we are called with !runtime_remaining due to things
	 * like user changed quota setting(see tg_set_cfs_bandwidth()) or async
	 * unthrottled us with a positive runtime_remaining but other still
	 * running entities consumed those runtime before we reached here.
	 * It's possible we are called with runtime_remaining < 0 due to things
	 * like async unthrottled us with a positive runtime_remaining but other
	 * still running entities consumed those runtime before we reached here.
	 *
	 * Anyway, we can't unthrottle this cfs_rq without any runtime remaining
	 * because any enqueue in tg_unthrottle_up() will immediately trigger a
	 * throttle, which is not supposed to happen on unthrottle path.
	 * We can't unthrottle this cfs_rq without any runtime remaining because
	 * any enqueue in tg_unthrottle_up() will immediately trigger a throttle,
	 * which is not supposed to happen on unthrottle path.
	 */
	if (cfs_rq->runtime_enabled && cfs_rq->runtime_remaining <= 0)
		return;

	se = cfs_rq->tg->se[cpu_of(rq)];

	cfs_rq->throttled = 0;

	update_rq_clock(rq);