From: Waiman Long <llong@redhat.com>
To: Gabriele Monaco <gmonaco@redhat.com>,
linux-kernel@vger.kernel.org,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v9 6/8] sched/isolation: Force housekeeping if isolcpus and nohz_full don't leave any
Date: Thu, 31 Jul 2025 11:09:27 -0400 [thread overview]
Message-ID: <a2ef7773-bec6-466f-81b3-e1d8f6cbe7b6@redhat.com> (raw)
In-Reply-To: <20250730131158.101668-7-gmonaco@redhat.com>
On 7/30/25 9:11 AM, Gabriele Monaco wrote:
> Currently the user can set up isolcpus and nohz_full in such a way that
> leaves no housekeeping CPU (i.e. no CPU that is neither domain isolated
> nor nohz full). This can be a problem for other subsystems (e.g. the
> timer wheel imgration).
>
> Prevent this configuration by invalidating the last setting in case the
> union of isolcpus and nohz_full covers all CPUs.
>
> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---
> kernel/sched/isolation.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index 93b038d48900..0019d941de68 100644
> --- a/kernel/sched/isolation.c
> +++ b/kernel/sched/isolation.c
> @@ -165,6 +165,18 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
> }
> }
>
> + /* Check in combination with the previously set cpumask */
> + type = find_first_bit(&housekeeping.flags, HK_TYPE_MAX);
> + first_cpu = cpumask_first_and_and(cpu_present_mask,
> + housekeeping_staging,
> + housekeeping.cpumasks[type]);
> + if (first_cpu >= nr_cpu_ids || first_cpu >= setup_max_cpus) {
> + pr_warn("Housekeeping: must include one present CPU neither "
> + "in nohz_full= nor in isolcpus=, ignoring setting %s\n",
> + str);
> + goto free_housekeeping_staging;
> + }
> +
> iter_flags = flags & ~housekeeping.flags;
>
> for_each_set_bit(type, &iter_flags, HK_TYPE_MAX)
I do have a question about this check. Currently isolcpus=domain is bit
0, managed_irq is bit 1 and nohz_full is bit 2. If manage_irq come first
followed by nohz_full and then isolcpus=domain. By the time,
isolcpus=domain is being set, you are comparing its cpumask with that of
manage_irq, not nohz_full.
Perhaps you can reuse the non_housekeeping_mask for doing the check, e.g.
cpumask_and(non_housekeeping_mask, cpu_present_mask,
housekeeping_staging);
iter_flags = housekeeping.flags & ~flags;
for_each_set_bit(type, &iter_flags, HK_TYPE_MAX)
cpumask_and(non_housekeeping_mask,
non_housekeeping_mask, housekeeping.cpumasks[type]);
if (cpumask_empty(non_housekeeping_mask)) {
pr_warn(...
Regards,
Longman
next prev parent reply other threads:[~2025-07-31 15:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 13:11 [PATCH v9 0/8] timers: Exclude isolated cpus from timer migration 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 [this message]
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
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=a2ef7773-bec6-466f-81b3-e1d8f6cbe7b6@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®