linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Sehee Jeong <sehee1.jeong@samsung.com>,
	anna-maria@linutronix.de, frederic@kernel.org, corbet@lwn.net
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	sehee1.jeong@samsung.com
Subject: Re: [PATCH v2 0/1] timers/migration: add 'tmigr' kernel parameter to optionally disable timer migration
Date: Tue, 07 Oct 2025 17:12:25 +0200	[thread overview]
Message-ID: <87jz163fvq.ffs@tglx> (raw)
In-Reply-To: <20250910074251.8148-1-sehee1.jeong@samsung.com>

On Wed, Sep 10 2025 at 16:42, Sehee Jeong wrote:
> This patch introduces a kernel boot parameter to optionally disable the
> timer migration.
>
> On heterogeneous systems with big.LITTLE architectures, timer migration
> may cause timers from little cores to run on big cores, or vice versa,
> because core type differences are not considered in the current timer
> migration logic.
>
> In our heterogeneous system, we observed timers being migrated to big
> CPU frequently, resulting in timer callbacks that could have run on
> little CPUs being executed on the big CPU instead. This reduced big
> CPU's idle residency and increased overall power consumption due to
> higher power draw on the big CPU. Since timer_migration is a relatively
> new feature, addressing the structural limitation was difficult.

It's not that new, but anyway I'm not understanding what's so difficult
to address that problem in the migration code. As all of that code is
based on a hierarchy, so it requires to ensure that:

   All big CPUs are on one side of the hierarchy and all little CPUs
   on the other side and those sides are not connected.

Taking the example from the comment on top of the code:

 * LVL 2                           [GRP2:0]
 *                              GRP1:0 = GRP1:M
 *
 * LVL 1            [GRP1:0]                      [GRP1:1]
 *               GRP0:0 - GRP0:2               GRP0:3 - GRP0:5
 *
 * LVL 0  [GRP0:0]  [GRP0:1]  [GRP0:2]  [GRP0:3]  [GRP0:4]  [GRP0:5]
 * CPUS     0-7       8-15      16-23     24-31     32-39     40-47

Assume that GRP1:0 is the big cluster and GRP1:1 is the little
cluster. Then obviously LVL2 is not required for this scenario. So the
resulting hierarchy looks like this:

 * LVL 1            [GRP1:0]                      [GRP1:1]
 *               GRP0:0 - GRP0:2               GRP0:3 - GRP0:5
 *
 * LVL 0  [GRP0:0]  [GRP0:1]  [GRP0:2]  [GRP0:3]  [GRP0:4]  [GRP0:5]
 * CPUS     0-7       8-15      16-23     24-31     32-39     40-47

It works nicely even when the clusters are asymetric, i.e. one requires
more levels than the other:

 * LVL 1            [GRP1:0]                      [GRP1:1]
 *               GRP0:0		               GRP0:1 - GRP0:3
 *
 * LVL 0  [GRP0:0]                        [GRP0:1]  [GRP0:2]  [GRP0:3]
 * CPUS     0-7                             8-15      16-23     24-31 

GRP1:0 is just there to keep the code simple, but as the hierarchy ends
there it is not any different than having only CPU 8-15 online in
GRP1:1.

That means the required changes boil down to:

  1) Calculate the hierarchy levels based on big/little clusters and not
     connect those clusters on top in tmigr_init(), which means the
     hierarchy levels are one less than on a connected system.

  2) Ensure that the CPUs end up on the correct side of the hierarchy in
     tmigr_setup_groups()

  3) Prevent tmigr_cpu_offline() from assigning a cross cluster migrator.

Everything else works out of the box.

I obviously might be missing the real difficulty you observed when you
tried to address this structural "limitation". You surely can explain
that to me then, right?

> Therefore, this patch adds a boot parameter to optionally disable timer
> migration.

You still did not address my comment, that this also means that all
timers must expire on the CPU they are armed on. Which in turn causes
less idle recidency in the overall system, no?

Thanks

        tglx

      parent reply	other threads:[~2025-10-07 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250910074257epcas2p2557473cfc52840b904ed22bdf1a3f27f@epcas2p2.samsung.com>
2025-09-10  7:42 ` [PATCH v2 0/1] timers/migration: add 'tmigr' kernel parameter to optionally disable timer migration Sehee Jeong
2025-09-10  7:42   ` [PATCH v2 1/1] " Sehee Jeong
2025-10-07 18:38     ` Randy Dunlap
2025-10-07 15:12   ` Thomas Gleixner [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=87jz163fvq.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=anna-maria@linutronix.de \
    --cc=corbet@lwn.net \
    --cc=frederic@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sehee1.jeong@samsung.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;
as well as URLs for NNTP newsgroup(s).