Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Cleanup upper_empty() in pid_list

Instead of find_first_bit() use the dedicated bitmap_empty(),
and make upper_empty() a nice one-liner.

While there, fix opencoded BITS_PER_TYPE().

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250429195119.620204-1-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Yury Norov and committed by
Steven Rostedt (Google)
45c28cdc 7b382efd

+2 -6
+2 -6
kernel/trace/pid_list.c
··· 81 81 { 82 82 /* 83 83 * If chunk->data has no lower chunks, it will be the same 84 - * as a zeroed bitmask. Use find_first_bit() to test it 85 - * and if it doesn't find any bits set, then the array 86 - * is empty. 84 + * as a zeroed bitmask. 87 85 */ 88 - int bit = find_first_bit((unsigned long *)chunk->data, 89 - sizeof(chunk->data) * 8); 90 - return bit >= sizeof(chunk->data) * 8; 86 + return bitmap_empty((unsigned long *)chunk->data, BITS_PER_TYPE(chunk->data)); 91 87 } 92 88 93 89 static inline int pid_split(unsigned int pid, unsigned int *upper1,