mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linwei Wang <wanix1988@gmail.com>
To: Aaron Lu <ziqianlu@bytedance.com>
Cc: Linwei Wang <wanix1988@gmail.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	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>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq
Date: Wed, 12 Nov 2025 22:21:19 +0800	[thread overview]
Message-ID: <20251112142119.375184-1-wanix1988@gmail.com> (raw)
In-Reply-To: <CANCG0GdjAaXG5U=9etbC3qo5uY7fbpFTG_RqoKcgChVSrLOKWA@mail.gmail.com>

Hi Aaron,

Your commit 956dfda6a708 removes the duplicate assignment after the early
return, but still initializes 'se' at declaration:

  struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];

This initialization happens before the early return check at line 6036-6037,
so when runtime_remaining <= 0 causes an early return, the array access
is wasted.

My patch defers initialization until after the early return:

  - struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];
  + struct sched_entity *se;
  ...
  + se = cfs_rq->tg->se[cpu_of(rq)];

Your commit fixes the duplicate assignment; mine optimizes the early return
path. They're independent optimizations.

Should I rebase on top of 956dfda6a708?

Thanks.


      reply	other threads:[~2025-11-12 14:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08  7:38 Linwei Wang
2025-11-11  7:40 ` Aaron Lu
2025-11-12 14:21   ` Linwei Wang [this message]

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=20251112142119.375184-1-wanix1988@gmail.com \
    --to=wanix1988@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=ziqianlu@bytedance.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®