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: <ee7c8d05-93bf-3cc8-781f-2d6302778b3f@nvidia.com>
Date:   Mon, 15 Nov 2021 14:57:58 +0200
From:   Nikolay Aleksandrov <nikolay@...dia.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        roopa@...dia.com, davem@...emloft.net, kuba@...nel.org
Cc:     bridge@...ts.linux-foundation.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] net: bridge: Slightly optimize 'find_portno()'

On 14/11/2021 21:02, Christophe JAILLET wrote:
> The 'inuse' bitmap is local to this function. So we can use the
> non-atomic '__set_bit()' to save a few cycles.
> 
> While at it, also remove some useless {}.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  net/bridge/br_if.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index c1183fef1f21..64b2d4fb50f5 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -397,10 +397,10 @@ static int find_portno(struct net_bridge *br)
>  	if (!inuse)
>  		return -ENOMEM;
>  
> -	set_bit(0, inuse);	/* zero is reserved */
> -	list_for_each_entry(p, &br->port_list, list) {
> -		set_bit(p->port_no, inuse);
> -	}
> +	__set_bit(0, inuse);	/* zero is reserved */
> +	list_for_each_entry(p, &br->port_list, list)
> +		__set_bit(p->port_no, inuse);
> +
>  	index = find_first_zero_bit(inuse, BR_MAX_PORTS);
>  	bitmap_free(inuse);
>  
> 

This should be targeted at net-next.
The patch itself looks ok, TBH it's a slow path so speed
doesn't really matter but it's a straight-forward change.

Acked-by: Nikolay Aleksandrov <nikolay@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ