* [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()'
@ 2021-11-21 18:01 Christophe JAILLET
2021-11-22 15:00 ` patchwork-bot+netdevbpf
2021-11-22 15:23 ` Xin Long
0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2021-11-21 18:01 UTC (permalink / raw)
To: davem, kuba, atenart, alexanderduyck, pabeni, weiwan, lucien.xin
Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET
The 'mask' bitmap is local to this function. So the non-atomic
'__set_bit()' can be used to save a few cycles.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
net/core/net-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 9c01c642cf9e..3be3f4a6add3 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1452,7 +1452,7 @@ static ssize_t xps_queue_show(struct net_device *dev, unsigned int index,
for (i = map->len; i--;) {
if (map->queues[i] == index) {
- set_bit(j, mask);
+ __set_bit(j, mask);
break;
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()'
2021-11-21 18:01 [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()' Christophe JAILLET
@ 2021-11-22 15:00 ` patchwork-bot+netdevbpf
2021-11-22 15:23 ` Xin Long
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-22 15:00 UTC (permalink / raw)
To: Christophe JAILLET
Cc: davem, kuba, atenart, alexanderduyck, pabeni, weiwan, lucien.xin,
netdev, linux-kernel, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Sun, 21 Nov 2021 19:01:03 +0100 you wrote:
> The 'mask' bitmap is local to this function. So the non-atomic
> '__set_bit()' can be used to save a few cycles.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> net/core/net-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- net-sysfs: Slightly optimize 'xps_queue_show()'
https://git.kernel.org/netdev/net-next/c/08a7abf4aff1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()'
2021-11-21 18:01 [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()' Christophe JAILLET
2021-11-22 15:00 ` patchwork-bot+netdevbpf
@ 2021-11-22 15:23 ` Xin Long
2021-11-22 19:10 ` Christophe JAILLET
1 sibling, 1 reply; 4+ messages in thread
From: Xin Long @ 2021-11-22 15:23 UTC (permalink / raw)
To: Christophe JAILLET
Cc: davem, Jakub Kicinski, atenart, Alexander Duyck, Paolo Abeni,
Wei Wang, network dev, LKML, kernel-janitors
On Sun, Nov 21, 2021 at 2:38 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> The 'mask' bitmap is local to this function. So the non-atomic
> '__set_bit()' can be used to save a few cycles.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> net/core/net-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 9c01c642cf9e..3be3f4a6add3 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -1452,7 +1452,7 @@ static ssize_t xps_queue_show(struct net_device *dev, unsigned int index,
>
> for (i = map->len; i--;) {
> if (map->queues[i] == index) {
> - set_bit(j, mask);
> + __set_bit(j, mask);
> break;
> }
> }
> --
> 2.30.2
>
The similar optimization can seem to be done in br_vlan.c and br_if.c as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()'
2021-11-22 15:23 ` Xin Long
@ 2021-11-22 19:10 ` Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2021-11-22 19:10 UTC (permalink / raw)
To: Xin Long
Cc: davem, Jakub Kicinski, atenart, Alexander Duyck, Paolo Abeni,
Wei Wang, network dev, LKML, kernel-janitors
Le 22/11/2021 à 16:23, Xin Long a écrit :
> On Sun, Nov 21, 2021 at 2:38 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> The 'mask' bitmap is local to this function. So the non-atomic
>> '__set_bit()' can be used to save a few cycles.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> net/core/net-sysfs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
>> index 9c01c642cf9e..3be3f4a6add3 100644
>> --- a/net/core/net-sysfs.c
>> +++ b/net/core/net-sysfs.c
>> @@ -1452,7 +1452,7 @@ static ssize_t xps_queue_show(struct net_device *dev, unsigned int index,
>>
>> for (i = map->len; i--;) {
>> if (map->queues[i] == index) {
>> - set_bit(j, mask);
>> + __set_bit(j, mask);
>> break;
>> }
>> }
>> --
>> 2.30.2
>>
> The similar optimization can seem to be done in br_vlan.c and br_if.c as well.
>
Hi,
br_if.c should be fixed in cc0be1ad686f.
br_vlan.c was not spotted by my heuristic (a set of grep, while looking
at something else). So, thanks for your feedback.
Feel free to propose a patch for it, it was not part of my todo list :)
If you prefer, I can also send a patch. Let me know.
CJ
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-22 19:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 18:01 [PATCH] net-sysfs: Slightly optimize 'xps_queue_show()' Christophe JAILLET
2021-11-22 15:00 ` patchwork-bot+netdevbpf
2021-11-22 15:23 ` Xin Long
2021-11-22 19:10 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).