net: bridge: Slightly optimize 'find_portno()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 14 Nov 2021 19:02:35 +0000 (20:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Nov 2021 14:07:06 +0000 (14:07 +0000)
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>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_if.c

index c1183fe..64b2d4f 100644 (file)
@@ -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);