From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: simplify sched_init_numa()
Date: Mon, 21 Jul 2025 14:02:44 +0530 [thread overview]
Message-ID: <aH37LDGeNHoT9abR@linux.ibm.com> (raw)
In-Reply-To: <20250719210753.401129-1-yury.norov@gmail.com>
* Yury Norov <yury.norov@gmail.com> [2025-07-19 17:07:51]:
> From: Yury Norov (NVIDIA) <yury.norov@gmail.com>
>
> The function opencodes for_each_set_bit() macro.
>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> ---
> kernel/sched/topology.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index b958fe48e020..7dc3c79aa480 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1932,10 +1932,9 @@ void sched_init_numa(int offline_node)
> return;
> }
>
> - for (i = 0, j = 0; i < nr_levels; i++, j++) {
> - j = find_next_bit(distance_map, NR_DISTANCE_VALUES, j);
> - distances[i] = j;
> - }
> + for_each_set_bit(j, distance_map, NR_DISTANCE_VALUES)
> + distances[i++] = j;
> +
Dont we need to reset the value of i;
Also now we may be iterating for NR_DISTANCE_VALUES instead of nr_levels.
It should be okay, since NR_DISTANCE_VALUES is just 8.
> rcu_assign_pointer(sched_domains_numa_distance, distances);
>
> bitmap_free(distance_map);
> --
> 2.43.0
>
--
Thanks and Regards
Srikar Dronamraju
next prev parent reply other threads:[~2025-07-21 8:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 21:07 Yury Norov
2025-07-21 8:32 ` Srikar Dronamraju [this message]
2025-08-19 8:52 ` Valentin Schneider
2025-08-19 14:14 ` Yury Norov
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=aH37LDGeNHoT9abR@linux.ibm.com \
--to=srikar@linux.ibm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yury.norov@gmail.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
all inboxes | Powered by JetHome®