From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Aaron Lu <ziqianlu@bytedance.com>
Cc: "Valentin Schneider" <vschneid@redhat.com>,
"Ben Segall" <bsegall@google.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Chengming Zhou" <chengming.zhou@linux.dev>,
"Josh Don" <joshdon@google.com>, "Ingo Molnar" <mingo@redhat.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Xi Wang" <xii@google.com>,
linux-kernel@vger.kernel.org,
"Juri Lelli" <juri.lelli@redhat.com>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Mel Gorman" <mgorman@suse.de>,
"Chuyi Zhou" <zhouchuyi@bytedance.com>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
"Florian Bezdeka" <florian.bezdeka@siemens.com>,
"Songtang Liu" <liusongtang@bytedance.com>,
"Chen Yu" <yu.c.chen@intel.com>,
"Matteo Martelli" <matteo.martelli@codethink.co.uk>,
"Michal Koutný" <mkoutny@suse.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Subject: Re: [PATCH] sched/fair: Prevent cfs_rq from being unthrottled with zero runtime_remaining
Date: Tue, 30 Sep 2025 14:28:16 +0530 [thread overview]
Message-ID: <658734b1-b02b-4e04-8479-ed17eb42c1f2@amd.com> (raw)
In-Reply-To: <20250930075602.GA510@bytedance>
Hello Aaron,
On 9/30/2025 1:26 PM, Aaron Lu wrote:
> On Mon, Sep 29, 2025 at 03:04:03PM +0530, K Prateek Nayak wrote:
> ... ...
>> Can we instead do a check_enqueue_throttle() in enqueue_throttled_task()
>> if we find cfs_rq->throttled_limbo_list to be empty?
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 18a30ae35441..fd2d4dad9c27 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -5872,6 +5872,8 @@ static bool enqueue_throttled_task(struct task_struct *p)
>> */
>> if (throttled_hierarchy(cfs_rq) &&
>> !task_current_donor(rq_of(cfs_rq), p)) {
> /*
> * Make sure to throttle this cfs_rq or it can be unthrottled
> * with no runtime_remaining and gets throttled again on its
> * unthrottle path.
> */
>> + if (list_empty(&cfs_rq->throttled_limbo_list))
>> + check_enqueue_throttle(cfs_rq);
>
> BTW, do you think a comment is needed? Something like the above, not
> sure if it's too redundant though, feel free to let me know your
> thoughts, thanks.
Now that I'm looking at it again, I think we should actually do a:
for_each_entity(se)
check_enqueue_throttle(cfs_rq_of(se));
The reason being, we can have:
root -> A (throttled) -> B -> C
Consider B has runtime_remaining = 0, and subsequently a throttled task
is queued onto C. Ideally, we should start the B/W timer for B at that
point but we bail out after queuing it on C. Thoughts?
Since we only catch up to the 0 runtime_remaining point, it should be
fine.
The comment can perhaps be something like:
/*
* If this is the first enqueue on throttled hierarchy,
* ensure bandwidth is available when the hierarchy is
* unthrottled. check_enqueue_throttle() will ensure
* either some bandwidth is available, or will throttle
* the cfs_rq and queue the bandwidth timer.
*/
>
>> list_add(&p->throttle_node, &cfs_rq->throttled_limbo_list);
>> return true;
>> }
>> ---
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2025-09-30 8:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 7:46 Aaron Lu
2025-09-29 9:34 ` K Prateek Nayak
2025-09-29 10:55 ` Aaron Lu
2025-09-30 7:56 ` Aaron Lu
2025-09-30 8:58 ` K Prateek Nayak [this message]
2025-09-30 9:27 ` Aaron Lu
2025-09-30 11:07 ` Aaron Lu
2025-09-30 12:39 ` Aaron Lu
2025-09-30 13:38 ` K Prateek Nayak
2025-10-01 11:58 ` Aaron Lu
2025-10-14 7:43 ` Hao Jia
2025-10-14 9:11 ` Aaron Lu
2025-10-14 11:01 ` Hao Jia
2025-10-14 11:50 ` Aaron Lu
2025-10-15 1:43 ` Hao Jia
2025-10-15 1:48 ` Hao Jia
2025-10-15 2:51 ` Aaron Lu
2025-10-15 6:31 ` Hao Jia
2025-10-15 8:40 ` Aaron Lu
2025-10-15 10:21 ` Hao Jia
2025-10-16 6:54 ` Aaron Lu
2025-10-16 7:49 ` Hao Jia
2025-10-16 9:23 ` Aaron Lu
2025-10-16 11:04 ` Hao Jia
2025-10-16 11:46 ` 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=658734b1-b02b-4e04-8479-ed17eb42c1f2@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=chengming.zhou@linux.dev \
--cc=dietmar.eggemann@arm.com \
--cc=florian.bezdeka@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liusongtang@bytedance.com \
--cc=matteo.martelli@codethink.co.uk \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=xii@google.com \
--cc=yu.c.chen@intel.com \
--cc=zhouchuyi@bytedance.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®