mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: yangsonghua <jluyangsonghua@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: 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>,
	Valentin Schneider <vschneid@redhat.com>,
	<linux-kernel@vger.kernel.org>,
	yangsonghua <yangsonghua@lixiang.com>
Subject: Re: [PATCH] sched/rt: Push RT tasks when preempted by a deadline task
Date: Wed, 24 Jun 2026 09:23:14 +0530	[thread overview]
Message-ID: <90277b52-e069-42a8-a8d8-9d9a59485d27@amd.com> (raw)
In-Reply-To: <20260624030442.3070759-1-yangsonghua@lixiang.com>

Hello Yangsonghua, 

On 6/24/2026 8:34 AM, yangsonghua wrote:
> @@ -1736,14 +1737,24 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct task_s
> 
>         update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 1);
> 
> -       if (task_is_blocked(p))
> -               return;
>         /*
>          * The previous task needs to be made eligible for pushing
> -        * if it is still active
> +        * if it is still active and migratable.
>          */
> -       if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
> +       if (!task_is_blocked(p) && on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
>                 enqueue_pushable_task(rq, p);
> +
> +       /*
> +        * When a deadline task takes over this CPU, try to push any queued
> +        * RT tasks to CPUs running lower-priority work. This is independent
> +        * of whether p itself is pushable: even if p is pinned or blocked,
> +        * there may be other migratable RT tasks already in pushable_tasks.
> +        *
> +        * rt_queue_push_tasks() guards on has_pushable_tasks() internally,
> +        * so this is a no-op if nothing is queued.
> +        */
> +       if (dl_task(next))
> +               rt_queue_push_tasks(rq);

next can be NULL if we are are coming here from sched_change_begin()
for the current task:

  sched_change_begin()
    put_prev_task()
      put_prev_task_rt(rq, prev, next = NULL)
        dl_task(next)
          dl_prio(next->prio) !!! NULL pointer dereference !!!

Do we avoid this in some way?

I don't know if this push was intentionally avoided or not. If there
are short running deadline task, we'll unnecessarily push a task and
pull it back later. Is that not a concern?

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-06-24  3:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24  3:04 yangsonghua
2026-06-24  3:53 ` K Prateek Nayak [this message]
     [not found]   ` <5213745e18453d424bea3d94af6bd31c5fc87620.a5e26565.899d.42c6.84f0.cf74cdb1acdd@feishu.cn>
2026-06-25  2:26     ` Eric yang
2026-06-25  3:09   ` yangsonghua

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=90277b52-e069-42a8-a8d8-9d9a59485d27@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jluyangsonghua@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yangsonghua@lixiang.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®