diff options
author | Jiebin Sun <[email protected]> | 2022-09-14 03:25:38 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2022-10-03 14:21:44 -0700 |
commit | 72d1e611082eda18689106a0c192f2827072713c (patch) | |
tree | 5325e3c5d0d7481c82c940bde971c5f738589e45 /lib/mpi/mpi-mod.c | |
parent | 5d0ce3595ab75330a15cec914096efbbb8b41e4a (diff) |
ipc/msg: mitigate the lock contention with percpu counter
The msg_bytes and msg_hdrs atomic counters are frequently updated when IPC
msg queue is in heavy use, causing heavy cache bounce and overhead.
Change them to percpu_counter greatly improve the performance. Since
there is one percpu struct per namespace, additional memory cost is
minimal. Reading of the count done in msgctl call, which is infrequent.
So the need to sum up the counts in each CPU is infrequent.
Apply the patch and test the pts/stress-ng-1.4.0
-- system v message passing (160 threads).
Score gain: 3.99x
CPU: ICX 8380 x 2 sockets
Core number: 40 x 2 physical cores
Benchmark: pts/stress-ng-1.4.0
-- system v message passing (160 threads)
[[email protected]: coding-style cleanups]
[[email protected]: avoid negative value by overflow in msginfo]
Link: https://lkml.kernel.org/r/[email protected]
[[email protected]: fix min() warnings]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jiebin Sun <[email protected]>
Reviewed-by: Tim Chen <[email protected]>
Cc: Alexander Mikhalitsyn <[email protected]>
Cc: Alexey Gladkov <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Dennis Zhou <[email protected]>
Cc: "Eric W . Biederman" <[email protected]>
Cc: Manfred Spraul <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Vasily Averin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-mod.c')
0 files changed, 0 insertions, 0 deletions