Skip to content

mm/vmalloc: lock contention optimization under multi-threading

rulinhuang linux-mm lkml 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest2 patches 13 repliesIn review
  2. v61 patch 5 repliesSuperseded
  3. v51 patch 1 replySuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v41 patch0 repliesSuperseded
v31 patch6 repliesSuperseded
v21 patch2 repliesSuperseded
v11 patch4 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/vmalloc: Moved macros with no functional change happenedmm/vmalloc.c+131 -13111 replies
2/2mm/vmalloc: Eliminated the lock contention from twice to oncemm/vmalloc.c+24 -281 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchBaoquan HeUladzislau Rezki (Sony)
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading

Hi,

This version has the rearrangement of macros from the previous one.

We are not sure whether we have completely moved these macros and their corresponding helper to the correct position. Could you please help to check whether they are correct?

~

1. Motivation

When allocating a new memory area where the mapping address range is known, it is observed that the vmap_node->busy.lock is acquired twice but one of the acquisitions is actually unnecessary.

2. Design

Among the two acquisitions, the first one occurs in the alloc_vmap_area() function when inserting the vm area into the vm mapping red-black tree, and the second one occurs in the setup_vmalloc_vm() function when updating the properties of the vm, such as flags and address, etc.

Combine these two operations together in alloc_vmap_area(), which improves scalability when the vmap_node->busy.lock is contended. By doing so, the need to acquire the lock twice can also be eliminated to once.

3. Test results

With the above change, tested on intel sapphire rapids platform(224 vcpu), a 4% performance improvement is gained on stress-ng/pthread(https://github.com/ColinIanKing/stress-ng), which is the stress test of thread creations.

rulinhuang

[v1] https://lore.kernel.org/all/[email protected]/
[v2] https://lore.kernel.org/all/[email protected]/
[v3] https://lore.kernel.org/all/[email protected]/
[v4] https://lore.kernel.org/all/[email protected]/
[v5] https://lore.kernel.org/all/[email protected]/
[v6] https://lore.kernel.org/lkml/[email protected]/

rulinhuang (2):
mm/vmalloc: Moved macros with no functional change happened mm/vmalloc: Eliminated the lock contention from twice to once

 mm/vmalloc.c | 314 +++++++++++++++++++++++++--------------------------
 1 file changed, 155 insertions(+), 159 deletions(-)

base-commit: 10c2cf5fe97647d68ee89b1f921e982e71519f20

Signature · 1 line
2.43.0