linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading
@ 2024-03-01 15:54 rulinhuang
  2024-03-01 15:54 ` [PATCH v7 1/2] mm/vmalloc: Moved macros with no functional change happened rulinhuang
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: rulinhuang @ 2024-03-01 15:54 UTC (permalink / raw)
  To: urezki, bhe
  Cc: akpm, colin.king, hch, linux-kernel, linux-mm, lstoakes,
	rulin.huang, tianyou.li, tim.c.chen, wangyang.guo, zhiguo.zhou

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/20240207033059.1565623-1-rulin.huang@intel.com/
[v2] https://lore.kernel.org/all/20240220090521.3316345-1-rulin.huang@intel.com/
[v3] https://lore.kernel.org/all/20240221032905.11392-1-rulin.huang@intel.com/
[v4] https://lore.kernel.org/all/20240222120536.216166-1-rulin.huang@intel.com/
[v5] https://lore.kernel.org/all/20240223130318.112198-2-rulin.huang@intel.com/
[v6] https://lore.kernel.org/lkml/aa8f0413-d055-4b49-bcd3-401e93e01c6d@intel.com/


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
-- 
2.43.0


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

end of thread, other threads:[~2024-03-09  4:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 15:54 [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading rulinhuang
2024-03-01 15:54 ` [PATCH v7 1/2] mm/vmalloc: Moved macros with no functional change happened rulinhuang
2024-03-06 13:23   ` Baoquan He
2024-03-06 19:01   ` Uladzislau Rezki
2024-03-07  1:23     ` Baoquan He
2024-03-07  3:01       ` Huang, Rulin
2024-03-07  3:32         ` Baoquan He
2024-03-07  5:48           ` Huang, Rulin
2024-03-07 19:53             ` Uladzislau Rezki
2024-03-07 19:16       ` Uladzislau Rezki
2024-03-08  8:23         ` Baoquan He
2024-03-08 10:28           ` Uladzislau Rezki
2024-03-09  4:54             ` Baoquan He
2024-03-01 15:54 ` [PATCH v7 2/2] mm/vmalloc: Eliminated the lock contention from twice to once rulinhuang
2024-03-06 13:55   ` Baoquan He
2024-03-06  9:18 ` [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading Huang, Rulin

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).