net: minor __dev_alloc_name() optimization
Subsystems (2)
PATCH 1/1 net: minor __dev_alloc_name() optimization
From: Eric Dumazet <[email protected]>
__dev_alloc_name() allocates a private zeroed page, then sets bits in it while iterating through net devices.
It can use __set_bit() to avoid unecessary locked operations.
--- net/core/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -1037,7 +1037,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)/* avoid cases where sscanf is not exact inverse of printf */ snprintf (buf,IFNAMSIZ , name, i);if (!strncmp (buf, name_node->name,IFNAMSIZ )) -set_bit (i, inuse); +__set_bit (i, inuse); }if (!sscanf (d->name, name, &i))continue ;
@@ -1047,7 +1047,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)/* avoid cases where sscanf is not exact inverse of printf */ snprintf (buf,IFNAMSIZ , name, i);if (!strncmp (buf, d->name,IFNAMSIZ )) -set_bit (i, inuse); +__set_bit (i, inuse); } i =find_first_zero_bit (inuse, max_netdevices);
Signature · 1 line
2.35.0.rc2.247.g8bbb082509-goog
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 2 Feb 2022 22:46:09 -0800 you wrote:
From: Eric Dumazet <[email protected]>
__dev_alloc_name()allocates a private zeroed page, then sets bits in it while iterating through net devices.It can use
__set_bit()to avoid unecessary locked operations.[...]
Here is the summary with links:
- [net-next] net: minor __dev_alloc_name() optimization
https://git.kernel.org/netdev/net-next/c/25ee1660a590
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 8 lines · On Wed, 2 Feb 2022 22:46:09 -0800 Eric Dumazet <[email protected]> wrote:
From: Eric Dumazet <[email protected]>
__dev_alloc_name()allocates a private zeroed page, then sets bits in it while iterating through net devices.It can use
__set_bit()to avoid unecessary locked operations.Signed-off-by Eric Dumazet <[email protected]>
That looks correct.