public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	linux-kernel@vger.kernel.org, pierre.gondois@arm.com,
	kprateek.nayak@amd.com, qyousef@layalina.io,
	hongyan.xia2@arm.com, christian.loehle@arm.com,
	luis.machado@arm.com
Subject: Re: [PATCH 0/6 v7] sched/fair: Add push task mecansim and hadle more EAS cases
Date: Mon, 1 Dec 2025 22:02:58 +0000	[thread overview]
Message-ID: <20251201220258.651c7d08@pumpkin> (raw)
In-Reply-To: <20251201091308.761711-1-vincent.guittot@linaro.org>

On Mon,  1 Dec 2025 10:13:02 +0100
Vincent Guittot <vincent.guittot@linaro.org> wrote:

...

If you've got sched/fair.c out on the operating table have a look at all the
code that multiplies by PELT_MIN_DIVISOR (about 48k).
There are max_t(u32) that (I think) mask the product to 32bits (on 64bit)
before assigning to a u64.
Conversely on 32bit the product is only 32bits - even though it is assigned
to a u64.

There might a valid justification for the 'utilisation' fitting in 32bits,
but I'm not sure it applies to any of the other fields.

There are also all the 'long' variables in the code - which change size
between 32bit and 64bit.
I failed to spot an explanation as to why this is valid.
I suspect they should all be either u32 or u64.

This all means that variables the 'runnable_sum' may be truncated and much
smaller than they ought to be.
I think that means the scheduler can incorrectly think a 'session' is idle
when, in fact, it is very busy.

I didn't do a full analysis of the code, just looked at a few expressions.

The 64bit code calculates 'long_var * PELT_MIN_DIVISOR' to get a 64bit product.
Doing a full 64x64 multiply if 32bit is rather more expensive.
Given PELT_MIN_DIVISOR is just a scale factor to get extra precision
(I think the product decays with time) multiplying by 32768 would be much
cheaper and have much the same effect.

	David

  parent reply	other threads:[~2025-12-01 22:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01  9:13 [PATCH 0/6 v7] sched/fair: Add push task mecansim and hadle more EAS cases Vincent Guittot
2025-12-01  9:13 ` [PATCH 1/6 v7] sched/fair: Filter false overloaded_group case for EAS Vincent Guittot
2025-12-01  9:13 ` [PATCH 2/6 v7] sched/fair: Update overutilized detection Vincent Guittot
2025-12-01  9:13 ` [PATCH 3/6 v7] sched/fair: Prepare select_task_rq_fair() to be called for new cases Vincent Guittot
2025-12-01  9:13 ` [PATCH 4/6 v7] sched/fair: Add push task mechanism for fair Vincent Guittot
2025-12-01  9:13 ` [RFC PATCH 5/6 v7] sched/fair: Enable idle core tracking for !SMT Vincent Guittot
2025-12-01  9:13 ` [RFC PATCH 6/6 v7] sched/fair: Add EAS and idle cpu push trigger Vincent Guittot
2025-12-01 13:53   ` Christian Loehle
2025-12-01 17:49     ` Vincent Guittot
2025-12-01 19:33       ` Vincent Guittot
2025-12-02  9:44   ` Hillf Danton
2025-12-02 13:01     ` Vincent Guittot
2025-12-03  9:00       ` Hillf Danton
2025-12-03 13:32         ` Vincent Guittot
2025-12-04  6:59           ` Hillf Danton
2025-12-05 15:02             ` Vincent Guittot
2025-12-06 10:31               ` Hillf Danton
2025-12-01 13:31 ` [PATCH 0/6 v7] sched/fair: Add push task mecansim and hadle more EAS cases Christian Loehle
2025-12-01 13:57   ` Christian Loehle
2025-12-01 17:48     ` Vincent Guittot
2025-12-01 17:48   ` Vincent Guittot
2025-12-01 22:02 ` David Laight [this message]
2025-12-02 13:24   ` Vincent Guittot

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=20251201220258.651c7d08@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bsegall@google.com \
    --cc=christian.loehle@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.machado@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pierre.gondois@arm.com \
    --cc=qyousef@layalina.io \
    --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