[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250523073939.GA1038318@bytedance>
Date: Fri, 23 May 2025 15:40:14 +0800
From: Aaron Lu <ziqianlu@...edance.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Valentin Schneider <vschneid@...hat.com>,
Ben Segall <bsegall@...gle.com>,
K Prateek Nayak <kprateek.nayak@....com>,
Josh Don <joshdon@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Xi Wang <xii@...gle.com>, linux-kernel@...r.kernel.org,
Juri Lelli <juri.lelli@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Mel Gorman <mgorman@...e.de>,
Chengming Zhou <chengming.zhou@...ux.dev>,
Chuyi Zhou <zhouchuyi@...edance.com>,
Jan Kiszka <jan.kiszka@...mens.com>,
Florian Bezdeka <florian.bezdeka@...mens.com>
Subject: Re: [PATCH 2/7] sched/fair: prepare throttle path for task based
throttle
On Thu, May 22, 2025 at 01:07:28PM +0200, Peter Zijlstra wrote:
> On Tue, May 20, 2025 at 06:41:05PM +0800, Aaron Lu wrote:
> > @@ -8851,6 +8913,7 @@ static struct task_struct *pick_task_fair(struct rq *rq)
> > {
> > struct sched_entity *se;
> > struct cfs_rq *cfs_rq;
> > + struct task_struct *p;
> >
> > again:
> > cfs_rq = &rq->cfs;
> > @@ -8871,7 +8934,14 @@ static struct task_struct *pick_task_fair(struct rq *rq)
> > cfs_rq = group_cfs_rq(se);
> > } while (cfs_rq);
> >
> > - return task_of(se);
> > + p = task_of(se);
> > + if (throttled_hierarchy(cfs_rq_of(se))) {
> > + /* Shuold not happen for now */
> > + WARN_ON_ONCE(1);
> > + task_throttle_setup_work(p);
> > + }
> > +
> > + return p;
> > }
>
> So the final code is a little different, because you're removing the
> return value from check_cfs_rq_runtime().
>
> But would not that exact return value be the thing you're now checking
> for again?
>
Ah yes.
> That is; at the end of the series, would not something like:
>
> static struct task_struct *pick_task_fair(struct rq *rq)
> {
> struct sched_entity *se;
> struct cfs_rq *cfs_rq;
> struct task_struct *p;
> bool throttled;
>
> again:
> cfs_rq = &rq->cfs;
> if (!cfs_rq->nr_queued)
> return NULL;
>
> throttled = false;
>
> do {
> if (cfs_rq->curr && cfs_rq->curr->on_rq)
> update_curr(cfs_rq);
>
> throttled |= check_cfs_rq_runtime(cfs_rq);
>
> se = pick_next_entity(rq, cfs_rq);
> if (!se)
> goto again;
>
> cfs_rq = group_cfs_rq(se);
> } while (cfs_rq);
>
> p = task_of(se);
> if (unlikely(throttled))
> task_throttle_setup_work(p);
> return p;
> }
>
> make it more obvious / be simpler?
Thanks for the suggestion, will follow it in next version.
Powered by blists - more mailing lists