From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id CBBE31F619 for ; Wed, 18 Mar 2020 12:12:52 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 790D73945C3A; Wed, 18 Mar 2020 12:12:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 790D73945C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1584533571; bh=LmjQud6yplMMPiJYZtqjfTJL2u6rCvSeM4gFRyhZz/A=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IK9vy+dxOWEqx8hqxst//fMGijrOsuPHL2nXyK6A9ltDmJ881ReuL6bbYFEnE65QV XkjIdOtp+R+WGAoqtJu4PWGN1ywBVJkWdE0I5HuEO9gbQoi3N2qqS1PljwSjO4iivs M1WHAEw8RalAf77KmTb1e0XJ00ZuKuHlz0Zq7xkE= Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by sourceware.org (Postfix) with ESMTP id 385D73944420 for ; Wed, 18 Mar 2020 12:12:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 385D73944420 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-337-5JaRLKM1MYK3b5G05hHr8A-1; Wed, 18 Mar 2020 08:12:47 -0400 X-MC-Unique: 5JaRLKM1MYK3b5G05hHr8A-1 Received: by mail-qv1-f69.google.com with SMTP id a1so17078151qvt.10 for ; Wed, 18 Mar 2020 05:12:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=LmjQud6yplMMPiJYZtqjfTJL2u6rCvSeM4gFRyhZz/A=; b=UvQQSluvxTb/E+97F3M1YNmuadDX+vrzFjwmmjQMQMQNOu00keQ+CMwXm+ntfQgubF J0/+nkOKsjaaSHJiEVhidyCaEvyoWd2m9RbH9OpxZbRYSgkKFSATZ46xnQRAyRsuxL+9 CYeG1/rXiwW9j+x/+Yvco/PNJt1OIQvpLht7IpLv4xXwH8jnbmBFyLyphda8Mr9bjPfF gwi12rjSLKNflRU6r5S2U5bJK5odkZ9LFHdhkfLQGHbgK9RxwMBk4yNgW9F2yhreVAqF hJfEOXCosITSBw2w/nhPDi4nggTGMZlv4raRHqQT7UdytAsf/5L8ucwwIBI/hFGhuoOf vpJA== X-Gm-Message-State: ANhLgQ3/+X5crnwlq3sXKzAFvyojwCTlk+1TtIrU1W4NuWBEayO1W5WK gscep7C+JPKmGM9po1IcpUq3gbau/xeQAUiXHBjckdSZaeNciDCQkgLGPL/nIsg+RMvMSh/zPP5 LsM6ZtL9oNx2kf4Qru4kp X-Received: by 2002:a37:5907:: with SMTP id n7mr3613206qkb.227.1584533566099; Wed, 18 Mar 2020 05:12:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtmrg5tCe17rexcLBne5iPai4AE9Fx+bIRoP4vs+e07wPIbMuhsEOrwEB9xJVX2mhzL6jo/tA== X-Received: by 2002:a37:5907:: with SMTP id n7mr3613173qkb.227.1584533565815; Wed, 18 Mar 2020 05:12:45 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id d28sm4030505qkl.99.2020.03.18.05.12.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Mar 2020 05:12:45 -0700 (PDT) Subject: Re: pthread_cond performence Discussion To: liqingqing , "libc-alpha@sourceware.org" , triegel@redhat.com References: Organization: Red Hat Message-ID: Date: Wed, 18 Mar 2020 08:12:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Cc: Hushiyuan , Liusirui , wangshuo47@huawei.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 3/16/20 3:30 AM, liqingqing wrote: > The new condvar implementation that provides stronger ordering > guarantees. For the waiters's ordering without expand the size of the > struct of pthread_cond_t, It uses a little bits to maintain the state > machine which has two different start group G1 and G2. This algorithm > is very cleverly. But when I test MySQL performance and found that > this new condvar implementation will affect the performance when > there are many cores in one machine. the scenario is that in my arm > server, test 200 terminals to read and write the database in 4P > processor environment(totally 256 cores), and I found that It can get > better performance when I use the old algorithm. Are you able to look at any hardware performance counters to see if there are increased cache line miss rates? > I think maybe there has too many cache false sharing when in my > environment. Does anyone has the same problem? And is there room for > optimization about the new algorithm? I have not seen anyone report a performance problem on large machines. Unfortunately from an ABI perspective we cannot increase the size of the structure, nor change the required alignment. We may be able to play with the order of the layout of elements within the condvar. That's something you could experiment with and report back to the list with your findings. For example: - Make changes the layout by moving elements around to attempt to avoid cache-line sharing. - Recompile glibc. - Install into your system. - PTHREAD_COND_INITIALIZER should be all-zero bytes so you should not need to recompile applications. - Retest performance. -- Cheers, Carlos.