public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Yang Yanchao <yangyanchao6@huawei.com>
To: <libc-alpha@sourceware.org>
Cc: <adhemerval.zanella@linaro.org>, <glebfm@altlinux.org>,
	<ldv@altlinux.org>, Carlos O'Donell <carlos@redhat.com>,
	<dj@redhat.com>, <siddhesh@sourceware.org>,
	<linfeilong@huawei.com>, <liqingqing3@huawei.com>
Subject: malloc: Optimize the number of arenas for better application performance
Date: Tue, 28 Jun 2022 17:40:23 +0800	[thread overview]
Message-ID: <4ffb458f-9c32-f0e5-8503-44838d87defe@huawei.com> (raw)

At Kunpeng920 platform, tpcc-mysql scores decreased by about 11.2% 
between glibc-2.36 and glibc2.28.
Comparing the code, I find that the two commits causes performance 
degradation.
11a02b035b46 (misc: Add __get_nprocs_sched)
97ba273b5057 (linux: __get_nprocs_sched: do not feed CPU_COUNT_S with 
garbage [BZ #28850])

These two patches modify the default behavior.
However, my machine is 96 cores and I have 91 cores bound.
It means that perhaps the current way of computing arenas is not optimal.
So I roll back some of the code submitted by 11a02b035(misc: Add 
__get_nprocs_sched).

---
  malloc/arena.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/malloc/arena.c b/malloc/arena.c
index 0a684a720d..a1ee7928d3 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -937,7 +937,7 @@ arena_get2 (size_t size, mstate avoid_arena)
              narenas_limit = mp_.arena_max;
            else if (narenas > mp_.arena_test)
              {
-              int n = __get_nprocs_sched ();
+              int n = __get_nprocs ();

                if (n >= 1)
                  narenas_limit = NARENAS_FROM_NCORES (n);
-- 
2.33.0

             reply	other threads:[~2022-06-28  9:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28  9:40 Yang Yanchao [this message]
2022-06-28 11:18 ` Florian Weimer
2022-06-28 12:38   ` Siddhesh Poyarekar
2022-06-28 13:35 ` Adhemerval Zanella
2022-06-28 18:56 ` DJ Delorie
2022-06-28 19:17   ` Adhemerval Zanella
     [not found]     ` <1a8f10e034e7489c8e9f090e9c90b396@huawei.com>
2022-06-29  2:37       ` 转发: " Qingqing Li
2022-06-29  5:25         ` Siddhesh Poyarekar
2022-06-29  8:05           ` [PATCH] malloc: Optimize the number of arenas for better application performance [BZ# 29296] Yang Yanchao

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=4ffb458f-9c32-f0e5-8503-44838d87defe@huawei.com \
    --to=yangyanchao6@huawei.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=dj@redhat.com \
    --cc=glebfm@altlinux.org \
    --cc=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linfeilong@huawei.com \
    --cc=liqingqing3@huawei.com \
    --cc=siddhesh@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).