mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp
@ 2025-12-03 10:01 Mateusz Guzik
  2025-12-08  8:24 ` Kuniyuki Iwashima
  2025-12-09 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Mateusz Guzik @ 2025-12-03 10:01 UTC (permalink / raw)
  To: kuniyu; +Cc: linux-kernel, netdev, kuba, oliver.sang, Mateusz Guzik

Otherwise the lock is susceptible to ever-changing false-sharing due to
unrelated changes. This in particular popped up here where an unrelated
change improved performance:
https://lore.kernel.org/oe-lkp/202511281306.51105b46-lkp@intel.com/

Stabilize it with an explicit annotation which also has a side effect
of furher improving scalability:
> in our oiginal report, 284922f4c5 has a 6.1% performance improvement comparing
> to parent 17d85f33a8.
> we applied your patch directly upon 284922f4c5. as below, now by
> "284922f4c5 + your patch"
> we observe a 12.8% performance improvements (still comparing to 17d85f33a8).

Note nothing was done for the other fields, so some fluctuation is still
possible.

Tested-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 net/unix/garbage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 78323d43e63e..25f65817faab 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -199,7 +199,7 @@ static void unix_free_vertices(struct scm_fp_list *fpl)
 	}
 }
 
-static DEFINE_SPINLOCK(unix_gc_lock);
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(unix_gc_lock);
 
 void unix_add_edges(struct scm_fp_list *fpl, struct unix_sock *receiver)
 {
-- 
2.48.1


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

* Re: [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp
  2025-12-03 10:01 [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp Mateusz Guzik
@ 2025-12-08  8:24 ` Kuniyuki Iwashima
  2025-12-09 11:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-12-08  8:24 UTC (permalink / raw)
  To: Mateusz Guzik; +Cc: linux-kernel, netdev, kuba, oliver.sang

On Wed, Dec 3, 2025 at 2:01 AM Mateusz Guzik <mjguzik@gmail.com> wrote:
>
> Otherwise the lock is susceptible to ever-changing false-sharing due to
> unrelated changes. This in particular popped up here where an unrelated
> change improved performance:
> https://lore.kernel.org/oe-lkp/202511281306.51105b46-lkp@intel.com/
>
> Stabilize it with an explicit annotation which also has a side effect
> of furher improving scalability:
> > in our oiginal report, 284922f4c5 has a 6.1% performance improvement comparing
> > to parent 17d85f33a8.
> > we applied your patch directly upon 284922f4c5. as below, now by
> > "284922f4c5 + your patch"
> > we observe a 12.8% performance improvements (still comparing to 17d85f33a8).
>
> Note nothing was done for the other fields, so some fluctuation is still
> possible.
>
> Tested-by: kernel test robot <oliver.sang@intel.com>
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

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

* Re: [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp
  2025-12-03 10:01 [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp Mateusz Guzik
  2025-12-08  8:24 ` Kuniyuki Iwashima
@ 2025-12-09 11:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-09 11:50 UTC (permalink / raw)
  To: Mateusz Guzik; +Cc: kuniyu, linux-kernel, netdev, kuba, oliver.sang

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  3 Dec 2025 11:01:22 +0100 you wrote:
> Otherwise the lock is susceptible to ever-changing false-sharing due to
> unrelated changes. This in particular popped up here where an unrelated
> change improved performance:
> https://lore.kernel.org/oe-lkp/202511281306.51105b46-lkp@intel.com/
> 
> Stabilize it with an explicit annotation which also has a side effect
> of furher improving scalability:
> > in our oiginal report, 284922f4c5 has a 6.1% performance improvement comparing
> > to parent 17d85f33a8.
> > we applied your patch directly upon 284922f4c5. as below, now by
> > "284922f4c5 + your patch"
> > we observe a 12.8% performance improvements (still comparing to 17d85f33a8).
> 
> [...]

Here is the summary with links:
  - af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp
    https://git.kernel.org/netdev/net/c/2183a5c8a04f

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] 3+ messages in thread

end of thread, other threads:[~2025-12-09 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03 10:01 [PATCH] af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp Mateusz Guzik
2025-12-08  8:24 ` Kuniyuki Iwashima
2025-12-09 11:50 ` patchwork-bot+netdevbpf

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®