From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BB283383577A for ; Tue, 28 Jun 2022 11:18:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB283383577A Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-yC1fdxDQN72cYR6APWXllQ-1; Tue, 28 Jun 2022 07:18:30 -0400 X-MC-Unique: yC1fdxDQN72cYR6APWXllQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BA6FC185A7A4; Tue, 28 Jun 2022 11:18:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65350C28115; Tue, 28 Jun 2022 11:18:28 +0000 (UTC) From: Florian Weimer To: Yang Yanchao via Libc-alpha Cc: Yang Yanchao , ldv@altlinux.org, linfeilong@huawei.com, siddhesh@sourceware.org Subject: Re: malloc: Optimize the number of arenas for better application performance References: <4ffb458f-9c32-f0e5-8503-44838d87defe@huawei.com> Date: Tue, 28 Jun 2022 13:18:26 +0200 In-Reply-To: <4ffb458f-9c32-f0e5-8503-44838d87defe@huawei.com> (Yang Yanchao via Libc-alpha's message of "Tue, 28 Jun 2022 17:40:23 +0800") Message-ID: <87bkudghod.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2022 11:18:34 -0000 * Yang Yanchao via Libc-alpha: > 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); How many threads does tpcc-mysql create? I wonder if all threads get their own arena with the larger count, and there is some arena sharing with the smaller count. Thanks, Florian