All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH] net: bridge: Slightly optimize 'find_portno()'
@ 2021-11-14 19:02 ` Christophe JAILLET
  0 siblings, 0 replies; 12+ messages in thread
From: Christophe JAILLET @ 2021-11-14 19:02 UTC (permalink / raw)
  To: roopa, nikolay, davem, kuba
  Cc: netdev, bridge, kernel-janitors, linux-kernel, Christophe JAILLET

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@wanadoo.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);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-16  8:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-14 19:02 [Bridge] [PATCH] net: bridge: Slightly optimize 'find_portno()' Christophe JAILLET
2021-11-14 19:02 ` Christophe JAILLET
2021-11-15 12:35 ` [Bridge] " Dan Carpenter
2021-11-15 12:35   ` Dan Carpenter
2021-11-15 18:35   ` [Bridge] " Christophe JAILLET
2021-11-15 18:35     ` Christophe JAILLET
2021-11-16  8:32     ` [Bridge] " Dan Carpenter
2021-11-16  8:32       ` Dan Carpenter
2021-11-15 12:57 ` [Bridge] " Nikolay Aleksandrov
2021-11-15 12:57   ` Nikolay Aleksandrov
2021-11-15 14:10 ` [Bridge] " patchwork-bot+netdevbpf
2021-11-15 14:10   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.