mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Frederic Weisbecker <frederic@kernel.org>,
	Waiman Long <llong@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>,
	linux-kernel@vger.kernel.org,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v9 8/8] timers: Exclude isolated cpus from timer migration
Date: Fri, 1 Aug 2025 15:15:53 -0400	[thread overview]
Message-ID: <e3ab032f-8e71-4cee-983f-14eb57294c16@redhat.com> (raw)
In-Reply-To: <aIy8E7IdpPr_KFtF@localhost.localdomain>

On 8/1/25 9:07 AM, Frederic Weisbecker wrote:
> Le Thu, Jul 31, 2025 at 02:25:30PM -0400, Waiman Long a écrit :
>> On 7/30/25 9:11 AM, Gabriele Monaco wrote:
>>> The timer migration mechanism allows active CPUs to pull timers from
>>> idle ones to improve the overall idle time. This is however undesired
>>> when CPU intensive workloads run on isolated cores, as the algorithm
>>> would move the timers from housekeeping to isolated cores, negatively
>>> affecting the isolation.
>>>
>>> Exclude isolated cores from the timer migration algorithm, extend the
>>> concept of unavailable cores, currently used for offline ones, to
>>> isolated ones:
>>> * A core is unavailable if isolated or offline;
>>> * A core is available if non isolated and online;
>>>
>>> A core is considered unavailable as isolated if it belongs to:
>>> * the isolcpus (domain) list
>>> * an isolated cpuset
>>> Except if it is:
>>> * in the nohz_full list (already idle for the hierarchy)
>> For the nohz_full list here, do you mean nohz_full housekeeping or
>> non-housekeeping list?
> nohz_full.
>
>>> @@ -436,6 +437,20 @@ static inline bool tmigr_is_not_available(struct tmigr_cpu *tmc)
>>>    	return !(tmc->tmgroup && tmc->available);
>>>    }
>>> +/*
>>> + * Returns true if @cpu should be excluded from the hierarchy as isolated.
>>> + * Domain isolated CPUs don't participate in timer migration, nohz_full
>>> + * CPUs are still part of the hierarchy but are always considered idle.
>>> + * This check is necessary, for instance, to prevent offline isolated CPU from
>>> + * being incorrectly marked as available once getting back online.
>>> + */
>>> +static inline bool tmigr_is_isolated(int cpu)
>>> +{
>>> +	return (!housekeeping_cpu(cpu, HK_TYPE_DOMAIN) ||
>>> +		cpuset_cpu_is_isolated(cpu)) &&
>>> +	       housekeeping_cpu(cpu, HK_TYPE_KERNEL_NOISE);
>>> +}
>> Does that mean a CPU in the nohz_full non-housekeeping list is always
>> considered not isolated WRT timer migration and hence will be made available
>> for timer migration purpose?
> Exactly, because nohz_full CPUs become idle (from a tick and timer migration
> POV) when they stop their tick. And since they are idle, their global timer
> are handled by the timekeeping CPU.
>
> This is much better than making the CPU unavailable like is done in this
> patchset for domain isolated CPUs, because unavailable CPUs must still handle
> their own global timers. Unfortunately we can't just fake them as well as idle,
> like we do with nohz_full CPUs, because that would mean walking the whole timer
> migration tree everytime a timer is queued or modified. This would be too
> costly.
>
> Indeed that should be commented somewhere in this function.

Thanks for the clarification. Yes, I agree that we should better 
document it in the code as it is not clear why we are doing that.

Cheers,
Longman


      reply	other threads:[~2025-08-01 19:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 13:11 [PATCH v9 0/8] " Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 1/8] timers/migration: Postpone online/offline callbacks registration to late initcall Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 2/8] timers: Rename tmigr 'online' bit to 'available' Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 3/8] timers: Add the available mask in timer migration Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 4/8] timers: Use scoped_guard when setting/clearing the tmigr available flag Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 5/8] cgroup/cpuset: Rename update_unbound_workqueue_cpumask() to update_exclusion_cpumasks() Gabriele Monaco
2025-07-31 14:42   ` Waiman Long
2025-07-30 13:11 ` [PATCH v9 6/8] sched/isolation: Force housekeeping if isolcpus and nohz_full don't leave any Gabriele Monaco
2025-07-31 15:09   ` Waiman Long
2025-08-01 14:46     ` Gabriele Monaco
2025-08-01 18:04       ` Waiman Long
2025-07-30 13:11 ` [PATCH v9 7/8] cgroup/cpuset: Fail if isolated and nohz_full don't leave any housekeeping Gabriele Monaco
2025-07-31 15:39   ` Waiman Long
2025-08-01 16:03     ` Gabriele Monaco
2025-07-30 13:11 ` [PATCH v9 8/8] timers: Exclude isolated cpus from timer migration Gabriele Monaco
2025-07-31 18:25   ` Waiman Long
2025-08-01 13:07     ` Frederic Weisbecker
2025-08-01 19:15       ` Waiman Long [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=e3ab032f-8e71-4cee-983f-14eb57294c16@redhat.com \
    --to=llong@redhat.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=gmonaco@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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®