[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANDhNCri7BCJimxvroJCecAAsag7Thcvv=2xY=xLVW6p3p=BgQ@mail.gmail.com>
Date: Thu, 4 Jan 2024 15:44:05 -0800
From: John Stultz <jstultz@...gle.com>
To: Metin Kaya <metin.kaya@....com>
Cc: LKML <linux-kernel@...r.kernel.org>, Joel Fernandes <joelaf@...gle.com>,
Qais Yousef <qyousef@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
Valentin Schneider <vschneid@...hat.com>, Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Zimuzo Ezeozue <zezeozue@...gle.com>,
Youssef Esmat <youssefesmat@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>, Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>, "Paul E. McKenney" <paulmck@...nel.org>,
Xuewen Yan <xuewen.yan94@...il.com>, K Prateek Nayak <kprateek.nayak@....com>,
Thomas Gleixner <tglx@...utronix.de>, kernel-team@...roid.com
Subject: Re: [PATCH v7 19/23] sched: Consolidate pick_*_task to
task_is_pushable helper
On Fri, Dec 22, 2023 at 2:23 AM Metin Kaya <metin.kaya@....com> wrote:
> On 20/12/2023 12:18 am, John Stultz wrote:
> > From: Connor O'Brien <connoro@...gle.com>
> >
> > This patch consolidates rt and deadline pick_*_task functions to
> > a task_is_pushable() helper
> >
> > This patch was broken out from a larger chain migration
> > patch originally by Connor O'Brien.
> >
> > Cc: Joel Fernandes <joelaf@...gle.com>
> > Cc: Qais Yousef <qyousef@...gle.com>
> > Cc: Ingo Molnar <mingo@...hat.com>
> > Cc: Peter Zijlstra <peterz@...radead.org>
> > Cc: Juri Lelli <juri.lelli@...hat.com>
> > Cc: Vincent Guittot <vincent.guittot@...aro.org>
> > Cc: Dietmar Eggemann <dietmar.eggemann@....com>
> > Cc: Valentin Schneider <vschneid@...hat.com>
> > Cc: Steven Rostedt <rostedt@...dmis.org>
> > Cc: Ben Segall <bsegall@...gle.com>
> > Cc: Zimuzo Ezeozue <zezeozue@...gle.com>
> > Cc: Youssef Esmat <youssefesmat@...gle.com>
> > Cc: Mel Gorman <mgorman@...e.de>
> > Cc: Daniel Bristot de Oliveira <bristot@...hat.com>
> > Cc: Will Deacon <will@...nel.org>
> > Cc: Waiman Long <longman@...hat.com>
> > Cc: Boqun Feng <boqun.feng@...il.com>
> > Cc: "Paul E. McKenney" <paulmck@...nel.org>
> > Cc: Metin Kaya <Metin.Kaya@....com>
> > Cc: Xuewen Yan <xuewen.yan94@...il.com>
> > Cc: K Prateek Nayak <kprateek.nayak@....com>
> > Cc: Thomas Gleixner <tglx@...utronix.de>
> > Cc: kernel-team@...roid.com
> > Signed-off-by: Connor O'Brien <connoro@...gle.com>
> > [jstultz: split out from larger chain migration patch,
> > renamed helper function]
> > Signed-off-by: John Stultz <jstultz@...gle.com>
> > ---
> > v7:
> > * Split from chain migration patch
> > * Renamed function
> > ---
> > kernel/sched/deadline.c | 10 +---------
> > kernel/sched/rt.c | 11 +----------
> > kernel/sched/sched.h | 10 ++++++++++
> > 3 files changed, 12 insertions(+), 19 deletions(-)
> >
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index def1eb23318b..1f3bc50de678 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -2049,14 +2049,6 @@ static void task_fork_dl(struct task_struct *p)
> > /* Only try algorithms three times */
> > #define DL_MAX_TRIES 3
> >
> > -static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu)
> > -{
> > - if (!task_on_cpu(rq, p) &&
> > - cpumask_test_cpu(cpu, &p->cpus_mask))
> > - return 1;
> > - return 0;
> > -}
> > -
> > /*
> > * Return the earliest pushable rq's task, which is suitable to be executed
> > * on the CPU, NULL otherwise:
> > @@ -2075,7 +2067,7 @@ static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
> > if (next_node) {
> > p = __node_2_pdl(next_node);
> >
> > - if (pick_dl_task(rq, p, cpu))
> > + if (task_is_pushable(rq, p, cpu) == 1)
>
> Nit: ` == 1` part is redundant, IMHO.
Indeed at this step is seems silly, but later task_is_pushable() can
return one of three states:
https://github.com/johnstultz-work/linux-dev/commit/1ebaf1b186f0cae8a4a26708776b347fa47decef#diff-cc1a82129952a910fdc4292448c2a097a2ba538bebefcf3c06381e45639ae73eR3973
I'm not a huge fan of this sort of magic tri-state return value, as
it's not very intuitive, so I need to spend some time to see if I can
find a better approach.
Thanks for pointing this out.
-john
Powered by blists - more mailing lists