Re: [PATCH 1/3] mm/numa_balancing: Teach mpol_to_str about the balancing mode
From: Matthew Wilcox
Date: Fri Jul 05 2024 - 10:44:01 EST
On Fri, Jul 05, 2024 at 03:32:16PM +0100, Tvrtko Ursulin wrote:
> + if (flags & MPOL_F_NUMA_BALANCING) {
> + if (hweight16(flags & MPOL_MODE_FLAGS) > 1)
hweight() > 1 seems somewhat inefficient.
!is_power_of_2() would be better. Or clear off the bits as they're
printed and print the bar if the remaining flags are not 0.
> + p += snprintf(p, buffer + maxlen - p, "|");
> + p += snprintf(p, buffer + maxlen - p, "balancing");
> + }
> }
>
> if (!nodes_empty(nodes))
> --
> 2.44.0
>
>