Files
laptops-kernel/include/linux
Alexander Lobakin 3e7e5baaab bitmap: don't assume compiler evaluates small mem*() builtins calls
Intel kernel bot triggered the build bug on ARC architecture that
in fact is as follows:

	DECLARE_BITMAP(bitmap, BITS_PER_LONG);

	bitmap_clear(bitmap, 0, BITS_PER_LONG);
	BUILD_BUG_ON(!__builtin_constant_p(*bitmap));

which can be expanded to:

	unsigned long bitmap[1];

	memset(bitmap, 0, sizeof(*bitmap));
	BUILD_BUG_ON(!__builtin_constant_p(*bitmap));

In most cases, a compiler is able to expand small/simple mem*()
calls to simple assignments or bitops, in this case that would mean:

	unsigned long bitmap[1] = { 0 };

	BUILD_BUG_ON(!__builtin_constant_p(*bitmap));

and on most architectures this works, but not on ARC, despite having
-O3 for every build.
So, to make this work, in case when the last bit to modify is still
within the first long (small_const_nbits()), just use plain
assignments for the rest of bitmap_*() functions which still use
mem*(), but didn't receive such compile-time optimizations yet.
This doesn't have the same coverage as compilers provide, but at
least something to start:

text: add/remove: 3/7 grow/shrink: 43/78 up/down: 1848/-3370 (-1546)
data: add/remove: 1/11 grow/shrink: 0/8 up/down: 4/-356 (-352)

notably cpumask_*() family when NR_CPUS <= BITS_PER_LONG:

netif_get_num_default_rss_queues              38       4     -34
cpumask_copy                                  90       -     -90
cpumask_clear                                146       -    -146

and the abovementioned assertion started passing.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
2022-06-30 19:52:42 -07:00
..
…
…
…
2022-05-10 16:03:52 +08:00
…
…
…
…
…
…
…
…
2022-04-20 12:59:50 +05:30
2022-05-22 20:44:29 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-06-08 14:04:14 -04:00
…
…
…
…
…
…
…
…
…
…
…
2022-05-20 15:29:00 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-04-22 12:32:03 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-16 13:37:59 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-06-03 06:52:57 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-13 07:20:18 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-02 14:06:20 -06:00
…
…
…
…
…
…
…
2022-06-06 09:52:17 +09:00
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-03 16:09:03 -04:00
…
…
…
…
…
…
…
…
…
2022-04-21 07:36:56 -04:00
2022-05-19 14:08:53 -07:00
…
…
…
…
2022-05-13 07:20:17 -07:00
…
…
…
…
…
2022-04-28 23:16:14 -07:00
…
2022-05-12 10:29:41 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
2022-04-28 16:31:10 +02:00
…
…
…
…
…
…
2022-05-17 13:32:46 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-04-19 10:19:02 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-06-10 11:29:48 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-22 21:03:01 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
2022-06-02 10:15:05 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-08 01:33:08 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2022-05-24 08:41:18 -06:00
…
…
…
…
2022-05-31 12:45:10 -04:00
…
2022-06-13 09:54:52 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…