From: Naman Jain <namjain@linux.microsoft.com>
To: Michael Kelley <mhklinux@outlook.com>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@kernel.org>,
Ming Lei <tom.leiming@gmail.com>, Ming Lei <ming.lei@redhat.com>
Cc: Wangyang Guo <wangyang.guo@intel.com>,
Tianyou Li <tianyou.li@intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Long Li <longli@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>
Subject: Re: [PATCH v2] lib/group_cpus: rotate extra groups to avoid IRQ stacking
Date: Thu, 3 Sep 2026 09:19:30 +0530 [thread overview]
Message-ID: <b48d7847-b8d0-4499-9462-e67ff5eb696c@linux.microsoft.com> (raw)
In-Reply-To: <SN6PR02MB4157F6AD93437B057878E048D4B72@SN6PR02MB4157.namprd02.prod.outlook.com>
On 9/2/2026 10:27 PM, Michael Kelley wrote:
> From: Naman Jain <namjain@linux.microsoft.com> Sent: Tuesday, September 1, 2026 10:03 PM
>>
>> On 9/1/2026 5:32 AM, Michael Kelley wrote:
>>> From: Naman Jain <namjain@linux.microsoft.com> Sent: Sunday, August 9, 2026 11:22 PM
>
> [snip]
>
>>>> @@ -270,11 +279,15 @@ static void assign_cpus_to_groups(unsigned int ncpus,
>>>> for (v = 0; v < nv->ngroups; v++, *curgrp += 1) {
>>>> cpus_per_grp = ncpus / nv->ngroups;
>>>>
>>>> - /* Account for extra groups to compensate rounding errors */
>>>> - if (extra_grps) {
>>>> + /*
>>>> + * Rotate which groups get the extra CPU so that
>>>> + * successive callers produce different mappings,
>>>> + * avoiding IRQ stacking when multiple devices
>>>> + * share the same CPU topology.
>>>> + */
>>>> + if (extra_grps &&
>>>
>>> Explicitly testing extra_grps for zero isn't necessary. If it is
>>> zero, the "less than" test below will always be false anyway.
>>>
>>
>> That is true, but the intention was to improve readability of this
>> block. Unless you really feel that this should be removed, I would
>> prefer to retain this.
>>
>
> Fair enough. It's your call unless Thomas Gleixner as the maintainer
> says otherwise. I flag these cases because I spend time looking for
> some subtle reason why the test is actually needed. For example,
> if the left side of the "less than" test below has side-effects, then
> checking extra_gaps for zero prevents the side-effects from occurring.
> To me the redundant test introduces ambiguity -- is there a reason
> it is needed, or is it superfluous?
>
In my head, I was reading it like this: If there are extra groups and
these groups satisfy this condition, do this. Other than that, it did
not add any value.
I should remove it.
> Interestingly, I had an identical conversation in another patch
> review [1] three days ago.
>
:) Sorry for the trouble and thank you again for reviewing the patch.
Regards,
Naman
prev parent reply other threads:[~2026-09-03 3:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 6:21 [PATCH v2] lib/group_cpus: rotate extra groups to avoid IRQ stacking Naman Jain
2026-08-10 6:32 ` sashiko-bot
2026-08-10 8:47 ` Naman Jain
2026-08-23 15:47 ` Michael Kelley
2026-08-24 14:35 ` Naman Jain
2026-08-26 2:01 ` Michael Kelley
2026-08-27 9:11 ` Naman Jain
2026-08-30 23:57 ` Michael Kelley
2026-08-31 5:31 ` Naman Jain
2026-09-01 0:02 ` Michael Kelley
2026-09-02 5:02 ` Naman Jain
2026-09-02 16:57 ` Michael Kelley
2026-09-03 3:49 ` Naman Jain [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=b48d7847-b8d0-4499-9462-e67ff5eb696c@linux.microsoft.com \
--to=namjain@linux.microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mhklinux@outlook.com \
--cc=ming.lei@redhat.com \
--cc=tglx@kernel.org \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=tom.leiming@gmail.com \
--cc=wangyang.guo@intel.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