From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id D5A8F385C32C for ; Thu, 29 Sep 2022 18:39:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5A8F385C32C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x535.google.com with SMTP id 29so3136296edv.7 for ; Thu, 29 Sep 2022 11:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=ZJqq4f3tbJoJduzYg4Wr1IGxQxKChfw9lbBn8+IOstE=; b=cQdZh4hHfwKT7voyEmXSJJF2X3t5TJ/uOAFpKB+EbSoUt0i/n63EDXdQpw3U78/97j ZSD7kGy28q76WcM5jQvj1TRO59iWVGRMGgI1Hgeeagh/ugIP3BNK8szd+Qm/3k9P3Xk/ ILSVRHoqnEp/Ewjl2RMCol17787XPaJk0nPjl7YlgjE8aBNiChj8MZrDxkuRqzHjd4Kv RVhWTpwNC/v1ap/PbrOeOt9tADPUJg+xURHWEZTZyxWtRAkvUxsc3bPhQmrur8o9JhKX xcf6bIhu2sO0Avfx+rNNS/V2BmD3JYZ+AYmNI795+c4nJirhjbG1iOUibChY8p4CNcHn 5Klw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=ZJqq4f3tbJoJduzYg4Wr1IGxQxKChfw9lbBn8+IOstE=; b=VzVFo6v5/74lUtSknjqBEe6+cncMzkc/BN3D4UsGcz1iUoAPxWKRBG51s9RnQ5hAha rEFGfOzFWM0wpLpOYHqf5xT0+V+Sz26RxIEZkjFKmlTZ/O0UrBbLyroNbD5jLFDc41Di keFFsSPeKp4eAQ6x7euONz063IArry/Jj3rt0z5Mqpnw2MPtduOcuRPA9wiBXpQQUTO9 iKWWtv+n7aiBYi01qGKXrB7NJwjh8poEKAvJJk/vwpce8/3uHQvbVt5oaFmdG5+V9mNr 1twLFTBfCrVf8R6w993tF145ZYTPMTR1l10UbEv2kzfAWsGVTTQqoy5rZQ1b0UCcfPoO aA4g== X-Gm-Message-State: ACrzQf3JjG0V/iYZWy5z4raO5YCbyQ/pgpbxOkcIXPzqil8ijR4Mof+F ZR9EowE8UGHDWbgE/5L3raf6IjdHS3D73miyP+dChhzR X-Google-Smtp-Source: AMsMyM6mxYmW4XaWMQfppwzT04v0ObfkGMRWxz+9ojRMGlZGb0hanG7I3y4/FUKBiE6qpdQiL6f/0dTBsNz9fXHcgao= X-Received: by 2002:a50:ea89:0:b0:453:8b7d:12e8 with SMTP id d9-20020a50ea89000000b004538b7d12e8mr4590619edo.148.1664476747567; Thu, 29 Sep 2022 11:39:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Thu, 29 Sep 2022 11:38:56 -0700 Message-ID: Subject: Re: [PATCH v1 2/4] nptl: Continue use arch prefered atomic exchange in spinlock loop To: Wilco Dijkstra Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Sep 29, 2022 at 9:35 AM Wilco Dijkstra wrote: > > Hi Noah, > > Did you try building it both ways? I don't think this could ever compile: > > + if (__glibc_likely (pthread_spin_lock_grab_lock (lock, &val, 1))) > > and: > > +# define pthread_spin_lock_grab_lock(mem, val, c) \ > + atomic_compare_exchange_weak_acquire (lock, &val, 1)) > > The define uses 'lock' and 'mem' inconsistently and the use of the macro > expands into &&val... > > Apart from that there is the question whether we should keep the weird > ATOMIC_EXCHANGE_USES_CAS setting - I have removed it in my atomic > patch series since most targets appear confused as to what it means (so > are likely to have the wrong setting). Also there is no evidence it is actually > faster. So using exchange in both cases is easier (and less error prone!). > > Also you do realize that no matter how much you change this code, it > won't make a difference on x86, right? Why's that? > > Cheers, > Wilco