Skip to contentSkip to conversation

tracing: cleanup upper_empty()

PATCH New Yury Norov 1 participant 1 message Apr 29, 2025 Tracing

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

PATCH 1/1 tracing: cleanup upper_empty()

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().

---
 kernel/trace/pid_list.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
kernel/trace/pid_list.c +2 -6
index c62b9b3cfb3d..549c299530a4 100644
@@ -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,
Signature · 1 line
2.43.0