lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZogGmvTfOXqUtyz6@casper.infradead.org>
Date: Fri, 5 Jul 2024 15:43:38 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Tvrtko Ursulin <tursulin@...lia.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
	Tvrtko Ursulin <tvrtko.ursulin@...lia.com>,
	Huang Ying <ying.huang@...el.com>, Mel Gorman <mgorman@...e.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Rik van Riel <riel@...riel.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Dave Hansen <dave.hansen@...el.com>,
	Andi Kleen <ak@...ux.intel.com>, Michal Hocko <mhocko@...e.com>,
	David Rientjes <rientjes@...gle.com>, stable@...r.kernel.org
Subject: Re: [PATCH 1/3] mm/numa_balancing: Teach mpol_to_str about the
 balancing mode

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
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ