[ICX] [SPR] [ipc/msg] performance: Mitigate the lock contention with percpu counter

Bug #2058485 reported by Thibf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Committed
Medium
Unassigned

Bug Description

This is a public version of https://bugs.launchpad.net/bugs/2034980

Backport: ipc/msg: mitigate the lock contention with percpu counter (merged upstream in 6.1) to jammy

[Impact]

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.

[Fix]

Backport:
  72d1e611082e ipc/msg: mitigate the lock contention with percpu counter

For clean backport/build, those are also required:

5d0ce3595ab75 percpu: add percpu_counter_add_local and percpu_counter_sub_local
38cd5b12b7854 ipc: Remove extra braces
0889f44e28103 ipc: Check permissions for checkpoint_restart sysctls at open time
dd141a4955d5e ipc: Remove extra1 field abuse to pass ipc namespace
def7343ff03bb ipc: Use the same namespace to modify and validate
1f5c135ee509e ipc: Store ipc sysctls in the ipc namespace
dc55e35f9e810 ipc: Store mqueue sysctls in the ipc namespace
0e9beb8a96f21 ipc/ipc_sysctl.c: remove fallback for !CONFIG_PROC_SYSCTL
5563cabdde7ee ipc: check checkpoint_restore_ns_capable() to modify C/R proc files

[Test Plan]

Test as the original patch, with pts/stress-ng message passing
and compare performance.

[Where problems could occur]

Performance regression in IPC communication/workload.

Thibf (thibf)
no longer affects: intel
Thibf (thibf)
description: updated
Changed in linux (Ubuntu):
status: New → Fix Released
Changed in linux (Ubuntu Jammy):
status: New → In Progress
Revision history for this message
Thibf (thibf) wrote :

Patchset submitted to kernel mailing list.

Stefan Bader (smb)
Changed in linux (Ubuntu Jammy):
importance: Undecided → Medium
Stefan Bader (smb)
Changed in linux (Ubuntu Jammy):
status: In Progress → Fix Committed
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux/5.15.0-104.114 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy-linux' to 'verification-done-jammy-linux'. If the problem still exists, change the tag 'verification-needed-jammy-linux' to 'verification-failed-jammy-linux'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: kernel-spammed-jammy-linux-v2 verification-needed-jammy-linux
Thibf (thibf)
tags: added: verification-done-jammy-linux
removed: verification-needed-jammy-linux
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.