linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: rulinhuang <rulin.huang@intel.com>
To: urezki@gmail.com, bhe@redhat.com
Cc: akpm@linux-foundation.org, colin.king@intel.com,
	hch@infradead.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, lstoakes@gmail.com, rulin.huang@intel.com,
	tianyou.li@intel.com, tim.c.chen@intel.com,
	wangyang.guo@intel.com, zhiguo.zhou@intel.com
Subject: [PATCH v7 0/2] mm/vmalloc: lock contention optimization under multi-threading
Date: Fri,  1 Mar 2024 10:54:15 -0500	[thread overview]
Message-ID: <20240301155417.1852290-1-rulin.huang@intel.com> (raw)

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


             reply	other threads:[~2024-03-01 15:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 15:54 rulinhuang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240301155417.1852290-1-rulin.huang@intel.com \
    --to=rulin.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=colin.king@intel.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=tianyou.li@intel.com \
    --cc=tim.c.chen@intel.com \
    --cc=urezki@gmail.com \
    --cc=wangyang.guo@intel.com \
    --cc=zhiguo.zhou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).