From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Aaron Lu <ziqianlu@bytedance.com>, Josh Don <joshdon@google.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] sched/fair: Unify cfs_rq throttling via account_cfs_rq_runtime()
Date: Tue, 2 Jun 2026 14:27:57 +0530 [thread overview]
Message-ID: <c2c0af00-8b99-421f-800e-6442a0f8c111@amd.com> (raw)
In-Reply-To: <20260602083239.GU3493090@noisy.programming.kicks-ass.net>
Hello Peter,
On 6/2/2026 2:02 PM, Peter Zijlstra wrote:
> On Tue, Jun 02, 2026 at 12:31:36PM +0530, K Prateek Nayak wrote:
>
>> My mind is taking a while to grasp the ->pick_next_task() removal.
>>
>> [1] https://lore.kernel.org/lkml/20260602050005.11160-1-kprateek.nayak@amd.com/
>
> Yes, I'm familiar with that struggle. If you can manage to write a
> comment that clarifies it somewhat that would be awesome.
>
> I've tried, but every time I read it back after a few days, I'm just
> left more confused that I was at the beginning :-(
Here is an attempt on top of v2.1:
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fa8c0b1a1cf1..9a14d75ff671 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9889,7 +9889,13 @@ struct task_struct *pick_task_fair(struct rq *rq, struct rq_flags *rf)
throttled = false;
do {
- /* Might not have done put_prev_entity() */
+ /*
+ * Might not have done put_prev_entity().
+ * The cfs_rq gets throttled here or via
+ * pick_task() -> set_next_task() where
+ * sched_cfs_bandwidth_slice() worth of
+ * runtime is requested for cfs_rq->curr.
+ */
if (cfs_rq->curr && cfs_rq->curr->on_rq)
update_curr(cfs_rq);
@@ -15003,7 +15009,12 @@ static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first)
break;
set_next_entity(cfs_rq, se, first);
- /* ensure bandwidth has been allocated on our new cfs_rq */
+ /*
+ * Ensure bandwidth has been allocated on our new cfs_rq.
+ * If this hierarchy was freshly picked, update_curr()
+ * was skipped for this cfs_rq. Request for the correct
+ * bandwidth slice now that cfs_rq->curr is updated.
+ */
throttled |= account_cfs_rq_runtime(cfs_rq, 0);
}
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-06-02 8:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 9:48 [PATCH 0/5] sched/fair: Allow account_cfs_rq_runtime() to throttle current hierarchy K Prateek Nayak
2026-05-28 9:48 ` [PATCH 1/5] sched/fair: Convert cfs bandwidth throttling to use guards K Prateek Nayak
2026-05-28 21:46 ` Benjamin Segall
2026-05-28 9:48 ` [PATCH 2/5] sched/fair: Use throttled_csd_list for local unthrottle K Prateek Nayak
2026-05-28 21:53 ` Benjamin Segall
2026-05-28 9:48 ` [PATCH 3/5] sched/fair: Call update_curr() before unthrottling the hierarchy K Prateek Nayak
2026-05-28 22:03 ` Benjamin Segall
2026-06-01 3:52 ` Aaron Lu
2026-06-01 5:50 ` K Prateek Nayak
2026-06-01 11:27 ` Peter Zijlstra
2026-06-02 6:33 ` K Prateek Nayak
2026-05-28 9:48 ` [PATCH 4/5] sched/fair: Move the throttled tasks to a local list in tg_unthrottle_up() K Prateek Nayak
2026-05-28 22:14 ` Benjamin Segall
2026-05-28 9:48 ` [PATCH 5/5] sched/fair: Unify cfs_rq throttling via account_cfs_rq_runtime() K Prateek Nayak
2026-05-28 22:44 ` Benjamin Segall
2026-06-01 13:48 ` Peter Zijlstra
2026-06-02 7:01 ` K Prateek Nayak
2026-06-02 8:32 ` Peter Zijlstra
2026-06-02 8:57 ` K Prateek Nayak [this message]
2026-05-28 11:45 ` [PATCH 0/5] sched/fair: Allow account_cfs_rq_runtime() to throttle current hierarchy Peter Zijlstra
2026-06-01 6:18 ` Aaron Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2c0af00-8b99-421f-800e-6442a0f8c111@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=ziqianlu@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®