From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
roopa@nvidia.com, davem@davemloft.net, kuba@kernel.org
Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net: bridge: Slightly optimize 'find_portno()'
Date: Mon, 15 Nov 2021 14:57:58 +0200 [thread overview]
Message-ID: <ee7c8d05-93bf-3cc8-781f-2d6302778b3f@nvidia.com> (raw)
In-Reply-To: <00c39d09c8df7ad0673bf2043f6566d6ef08b789.1636916479.git.christophe.jaillet@wanadoo.fr>
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@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);
>
>
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@nvidia.com>
next prev parent reply other threads:[~2021-11-15 12:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-14 19:02 Christophe JAILLET
2021-11-15 12:35 ` Dan Carpenter
2021-11-15 18:35 ` Christophe JAILLET
2021-11-16 8:32 ` Dan Carpenter
2021-11-15 12:57 ` Nikolay Aleksandrov [this message]
2021-11-15 14:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee7c8d05-93bf-3cc8-781f-2d6302778b3f@nvidia.com \
--to=nikolay@nvidia.com \
--cc=bridge@lists.linux-foundation.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roopa@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®