From: Hongyan Xia <hongyan.xia@transsion.com>
To: Li kunyu <likunyu10@163.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
"dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"bsegall@google.com" <bsegall@google.com>,
"mgorman@suse.de" <mgorman@suse.de>,
"vschneid@redhat.com" <vschneid@redhat.com>,
"kprateek.nayak@amd.com" <kprateek.nayak@amd.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/sched/fair: Fix to not require calculation for the weight nice0
Date: Fri, 29 May 2026 07:37:07 +0000 [thread overview]
Message-ID: <edd47e8e-710c-4eec-9454-3266198a536d@transsion.com> (raw)
In-Reply-To: <20260529023413.482020-1-likunyu10@163.com>
On 5/29/2026 10:34 AM, Li kunyu wrote:
> Typically, the default priority for client tasks is nice0, and reducing
> the conversion of virtual runtime to real time for nice0 tasks can
> significantly reduce unnecessary computations.
>
> Signed-off-by: Li kunyu <likunyu10@163.com>
> ---
> kernel/sched/fair.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 69361c63353a..74d1c77a8bcf 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7033,7 +7033,10 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
> resched_curr(rq);
> return;
> }
> - delta = (se->load.weight * vdelta) / NICE_0_LOAD;
> + if (unlikely(se->load.weight != NICE_0_LOAD))
> + delta = (se->load.weight * vdelta) / NICE_0_LOAD;
> + else
> + delta = vdelta;
>
> /*
> * Correct for instantaneous load of other classes.
Given NICE_0_LOAD is a nice power-of-two which compiles down to just a
bit shift, it seems interesting that you would find the multiplication
to be 'significant unnecessary computations'. Do you have any data to
support this?
Also, unless my eyes are failing, it looks like you had a patch just a
couple of days ago at the exact same location
https://lore.kernel.org/all/20260527072113.359604-1-likunyu10@163.com/
in which Peter pointed out you might had a mistake. Is this somehow
connected to that one?
Hongyan
next prev parent reply other threads:[~2026-05-29 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 2:34 Li kunyu
2026-05-29 7:37 ` Hongyan Xia [this message]
2026-05-29 8:13 ` Li kunyu
2026-05-29 12:01 ` Peter Zijlstra
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=edd47e8e-710c-4eec-9454-3266198a536d@transsion.com \
--to=hongyan.xia@transsion.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=likunyu10@163.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 \
/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®