[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220712102953.02d4a3bd@gandalf.local.home>
Date: Tue, 12 Jul 2022 10:29:53 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Schspa Shi <schspa@...il.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
vschneid@...hat.com, linux-kernel@...r.kernel.org,
zhaohui.shi@...izon.ai
Subject: Re: [PATCH v5 2/2] sched/rt: Trying to push current task when
target disable migrating
On Tue, 12 Jul 2022 09:31:25 +0800
Schspa Shi <schspa@...il.com> wrote:
> When the task to push disable migration, retry to push the current
> running task on this CPU away, instead doing nothing for this migrate
> disabled task.
>
> Signed-off-by: Schspa Shi <schspa@...il.com>
> ---
> kernel/sched/core.c | 6 +++++-
> kernel/sched/rt.c | 6 ++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index da0bf6fe9ecdc..0b1fefd97d874 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2509,8 +2509,12 @@ int push_cpu_stop(void *arg)
> if (p->sched_class->find_lock_rq)
> lowest_rq = p->sched_class->find_lock_rq(p, rq);
>
> - if (!lowest_rq)
> + if (!lowest_rq) {
Probably should add a comment reminding us that the find_lock() function
above could have released the rq lock and allow p to schedule and be
preempted again, and that lowest_rq could be NULL because p now has the
migrate_disable flag set and not because it could not find the lowest rq.
-- Steve
> + if (unlikely(is_migration_disabled(p)))
> + p->migration_flags |= MDF_PUSH;
> +
> goto out_unlock;
> + }
>
> // XXX validate p is still the highest prio task
> if (task_rq(p) == rq) {
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 7c32ba51b6d85..877380e465b7a 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2136,6 +2136,12 @@ static int push_rt_task(struct rq *rq, bool pull)
> */
> task = pick_next_pushable_task(rq);
> if (task == next_task) {
> + /*
> + * If next task has now disabled migrating, see if we
> + * can push the current task.
> + */
> + if (unlikely(is_migration_disabled(task)))
> + goto retry;
> /*
> * The task hasn't migrated, and is still the next
> * eligible task, but we failed to find a run-queue
Powered by blists - more mailing lists