mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: albin_yang@163.com
Cc: albinwyang@tencent.com, bsegall@google.com, chen.yu@linux.dev,
	dietmar.eggemann@arm.com, juri.lelli@redhat.com,
	kayracizmeci@gmail.com, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com,
	mintaohuang@tencent.com, peterz@infradead.org,
	rostedt@goodmis.org, vincent.guittot@linaro.org,
	vschneid@redhat.com, yu.c.chen@intel.com
Subject: Re: [PATCH v2] sched/stats: Fix run_delay over-count for migrated sched_delayed tasks
Date: Sun, 20 Sep 2026 14:15:35 +0300	[thread overview]
Message-ID: <20260920111535.117996-1-kayracizmeci@gmail.com> (raw)
In-Reply-To: <20260920043116.1298017-1-albin_yang@163.com>

Hi Wei,

> Load balance is affected too: the sched_delayed check in can_migrate_task()
> bails out only when env->migration_type != migrate_load, so it does not
> block migration when the type is migrate_load - which active load balance
> always uses (its lb_env leaves migration_type at 0 == migrate_load), and
> which regular load balance can also use via calculate_imbalance(). Either
> way the re-attach goes through attach_task() -> activate_task(rq, p,
> ENQUEUE_NOCLOCK), without ENQUEUE_RESTORE.

> @@ -290,7 +290,7 @@ static void sched_info_arrive(struct rq *rq, struct task_struct *t)
>   */
>  static inline void sched_info_enqueue(struct rq *rq, struct task_struct *t)
>  {
> -	if (!t->sched_info.last_queued)
> +	if (!t->sched_info.last_queued && !t->se.sched_delayed)
>  		t->sched_info.last_queued = rq_clock(rq);
>  }

Well sched_info_enqueue() gets called from 2 places. The comment above says
otherwise but it's wrong. It gets called from sched_info_depart() and
enqueue_task().

I'll send a patch about that comment later. 

Anyway,

Let's say detach_one_task() found the p to detach on active_load_balance_cpu_stop(),
from there, p goes to attach_task() from there. And then 
activate_task(), therefore enqueue_task() and
sched_info_enqueue().

If p is delayed then, correctly the sched_info_enqueue() will not start the clock.
If not, it will. 

On the second call chain tho, there are task_is_running protection before entering sched_info_enqueue(),
therefore a task cannot run if it is delayed. So the patch's case never runs on that path. 

Here:
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>


Thanks,
Kayra :>

  reply	other threads:[~2026-09-20 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  4:31 albin_yang
2026-09-20 11:15 ` Kayra Cizmeci [this message]
2026-09-21  5:32 ` K Prateek Nayak

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=20260920111535.117996-1-kayracizmeci@gmail.com \
    --to=kayracizmeci@gmail.com \
    --cc=albin_yang@163.com \
    --cc=albinwyang@tencent.com \
    --cc=bsegall@google.com \
    --cc=chen.yu@linux.dev \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mintaohuang@tencent.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yu.c.chen@intel.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®