tracing: Cleanup upper_empty() in pid_list
authorYury Norov <yury.norov@gmail.com>
Tue, 29 Apr 2025 19:51:18 +0000 (15:51 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 14 May 2025 15:19:32 +0000 (11:19 -0400)
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>
kernel/trace/pid_list.c

index c62b9b3cfb3d8ebb6b15d1060a2e70f54598c4ed..090bb5ea4a195cca73619b874bc2fe2ac5471236 100644 (file)
@@ -81,13 +81,9 @@ static inline bool upper_empty(union upper_chunk *chunk)
 {
        /*
         * If chunk->data has no lower chunks, it will be the same
-        * as a zeroed bitmask. Use find_first_bit() to test it
-        * and if it doesn't find any bits set, then the array
-        * is empty.
+        * as a zeroed bitmask.
         */
-       int bit = find_first_bit((unsigned long *)chunk->data,
-                                sizeof(chunk->data) * 8);
-       return bit >= sizeof(chunk->data) * 8;
+       return bitmap_empty((unsigned long *)chunk->data, BITS_PER_TYPE(chunk->data));
 }
 
 static inline int pid_split(unsigned int pid, unsigned int *upper1,