<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/nodemask.h, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-11-20T15:02:22+00:00</updated>
<entry>
<title>nodemask: use min() instead of min_t()</title>
<updated>2025-11-20T15:02:22+00:00</updated>
<author>
<name>David Laight</name>
<email>david.laight.linux@gmail.com</email>
</author>
<published>2025-11-19T22:41:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d1cadd4bfc2802c6f73b1739dbceef7513afc591'/>
<id>urn:sha1:d1cadd4bfc2802c6f73b1739dbceef7513afc591</id>
<content type='text'>
min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
and so cannot discard significant bits.

In this case the 'unsigned long' value is small enough that the result
is ok.

Detected by an extra check added to min_t().

Signed-off-by: David Laight &lt;david.laight.linux@gmail.com&gt;
Signed-off-by: Yury Norov (NVIDIA) &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>bitmap: generalize node_random()</title>
<updated>2025-07-08T23:11:57+00:00</updated>
<author>
<name>Yury Norov [NVIDIA]</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2025-06-19T18:26:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c56f97c5c71f17d781461d44acb777cd21521b81'/>
<id>urn:sha1:c56f97c5c71f17d781461d44acb777cd21521b81</id>
<content type='text'>
Generalize node_random() and make it available to general bitmaps and
cpumasks users.

Notice, find_first_bit() is generally faster than find_nth_bit(), and we
employ it when there's a single set bit in the bitmap.

See commit 3e061d924fe9c7b4 ("lib/nodemask: optimize node_random for
nodemask with single NUMA node").

CC: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: "Yury Norov [NVIDIA]" &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>topology: make for_each_node_with_cpus() O(N)</title>
<updated>2025-05-13T15:40:04+00:00</updated>
<author>
<name>Yury Norov [NVIDIA]</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2025-05-09T16:20:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=895ee6a22e3195b7c1fee140c842bdeedb89ed33'/>
<id>urn:sha1:895ee6a22e3195b7c1fee140c842bdeedb89ed33</id>
<content type='text'>
for_each_node_with_cpus() calls nr_cpus_node() at every iteration, which
makes it O(N^2). Kernel tracks such nodes with N_CPU record in node_states
array. Switching to it makes for_each_node_with_cpus() O(N).

Andrea:

Now we can include also offline nodes with CPUs assigned (assuming it's
possible). If checking the online state is required, the user must use
node_online() within the loop.

CC: Andrea Righi &lt;arighi@nvidia.com&gt;
CC:Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>nodemask: drop nodes_shift</title>
<updated>2025-04-29T19:58:37+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2025-03-13T02:19:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=74a2bd0bfb0675cb8f276f2fe3ede0c7f9e78fa3'/>
<id>urn:sha1:74a2bd0bfb0675cb8f276f2fe3ede0c7f9e78fa3</id>
<content type='text'>
nodes_shift_{left,right} are not used. Drop them.

Signed-off-by: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>nodemask: numa: reorganize inclusion path</title>
<updated>2025-02-16T16:52:19+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2025-02-14T19:40:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=14a8262f505bc4478c50e66309057bc0d0d4b62e'/>
<id>urn:sha1:14a8262f505bc4478c50e66309057bc0d0d4b62e</id>
<content type='text'>
Nodemasks now pull linux/numa.h for MAX_NUMNODES and NUMA_NO_NODE
macros. This series makes numa.h depending on nodemasks, so we hit
a circular dependency.

Nodemasks library is highly employed by NUMA code, and it would be
logical to resolve the circular dependency by making NUMA headers
dependent nodemask.h.

Signed-off-by: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>nodemask: add nodes_copy()</title>
<updated>2025-02-16T16:52:19+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2025-02-14T19:40:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7665054ee0dd0caba6f5f7bae48aa5f221218496'/>
<id>urn:sha1:7665054ee0dd0caba6f5f7bae48aa5f221218496</id>
<content type='text'>
Nodemasks API misses the plain nodes_copy() which is required in this
series.

Signed-off-by: Yury Norov [NVIDIA] &lt;yury.norov@gmail.com&gt;
Signed-off-by: Andrea Righi &lt;arighi@nvidia.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>nodemask: Switch from inline to __always_inline</title>
<updated>2024-08-18T17:08:00+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2024-07-19T00:50:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54c9e0085bd1015e524d8f4d3c4e78a7bc77ffca'/>
<id>urn:sha1:54c9e0085bd1015e524d8f4d3c4e78a7bc77ffca</id>
<content type='text'>
'inline' keyword is only a recommendation for compiler. If it decides to
not inline nodemask functions, the whole small_const_nbits() machinery
doesn't work.

This is how a standard GCC 11.3.0 does for my x86_64 build now. This patch
replaces 'inline' directive with unconditional '__always_inline' to make
sure that there's always a chance for compile-time optimization. It doesn't
change size of kernel image, according to bloat-o-meter.

[[ Brian: split out from:
      Subject: [PATCH 1/3] bitmap: switch from inline to __always_inline
      https://lore.kernel.org/all/20221027043810.350460-2-yury.norov@gmail.com/
   But rewritten, as there were too many conflicts. ]]

Co-developed-by: Brian Norris &lt;briannorris@chromium.org&gt;
Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Reviewed-by: Kees Cook &lt;kees@kernel.org&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>nodemask: Split out include/linux/nodemask_types.h</title>
<updated>2023-12-21T00:26:30+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2022-12-06T19:32:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bea32141764bc76db2d75c9484b71ded56119ab4'/>
<id>urn:sha1:bea32141764bc76db2d75c9484b71ded56119ab4</id>
<content type='text'>
sched.h, which defines task_struct, needs nodemask_t - but sched.h is a
frequently used header and ideally shouldn't be pulling in any more code
that it needs to.

This splits out nodemask_types.h which has the definition sched.h needs,
which will avoid a circular header dependency in the alloc tagging patch
series, and as a bonus should speed up kernel build times.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>nodemask: Drop duplicate check in for_each_node_mask()</title>
<updated>2023-06-22T20:57:41+00:00</updated>
<author>
<name>Gavin Shan</name>
<email>gshan@redhat.com</email>
</author>
<published>2023-01-24T00:02:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cdd2d06fbc0a58297f782c8eb7e2f3c0b1dc367e'/>
<id>urn:sha1:cdd2d06fbc0a58297f782c8eb7e2f3c0b1dc367e</id>
<content type='text'>
The return value type is changed from 'int' to 'unsigned int' since
commit 0dfe54071d7c8 ("nodemask: Fix return values to be unsigned").
Besides, the conversion between 'int' and 'unsigned int' on the
parameter @node is guaranteed to be safe due to the limited range of
MAX_NUMNODES and CONFIG_NODES_SHIFT. By the way, '(node &gt;= 0)' should
have been '(node) &gt;= 0' actually.

It's unnecessary to check if their return values are greater or equal
to 0 in for_each_node_mask(). Remove it.

No functional change intended.

Signed-off-by: Gavin Shan &lt;gshan@redhat.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
</entry>
<entry>
<title>treewide: use get_random_u32_below() instead of deprecated function</title>
<updated>2022-11-18T01:15:15+00:00</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-10T02:44:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8032bf1233a74627ce69b803608e650f3f35971c'/>
<id>urn:sha1:8032bf1233a74627ce69b803608e650f3f35971c</id>
<content type='text'>
This is a simple mechanical transformation done by:

@@
expression E;
@@
- prandom_u32_max
+ get_random_u32_below
  (E)

Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Darrick J. Wong &lt;djwong@kernel.org&gt; # for xfs
Reviewed-by: SeongJae Park &lt;sj@kernel.org&gt; # for damon
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt; # for infiniband
Reviewed-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt; # for arm
Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt; # for mmc
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
</feed>
