From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id B36E33858C30; Thu, 12 Oct 2023 15:45:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B36E33858C30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1697125552; bh=gEtGyr02Z5OSY5cv4Rvs3GuEFZLUttCIA/pWS+xyBHk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=wLIooYHFAbDS4qcGP1VkGDjzWDzVuzEJ9CWly31qVmghzIXIfbqbKTmoiyJvrV9NF o+8qDE3xK0bVs9Y+R4FMklR/aj/1zchMfpkYgb4ADa18pslRZEgVApgg5mVYteS850 rwwQ2SGwnWXTWw5s2HnCXFae9aSrqoXCmmzZyHj2sQqunrjKOQP9hlR+umM0i9g3It gNMcfIn4T635D9zC73ie3/bfi0MN9zwRC1eCOZqinfjFwG1I82QdVV+XulKH9e7qkM NMt+pc0U3QxQEL86mzHhXQHChq1DOzxNzllwQGuyvBNttYAo5ZqBj41Kka07WDC3qo 2x/sodE2yElnw== Received: from localhost (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4S5v9r1DhLz1X8N; Thu, 12 Oct 2023 11:45:52 -0400 (EDT) From: Olivier Dion To: libc-help@sourceware.org, libc-alpha@sourceware.org Cc: Mathieu Desnoyers , Adhemerval Zanella Netto , "carlos@redhat.com" , Florian Weimer Subject: Re: Dead code in pthread_cond_wait() for spin-wait In-Reply-To: Organization: EfficiOS References: <87a5spvwoi.fsf@laura> Date: Thu, 12 Oct 2023 11:45:51 -0400 Message-ID: <87ttqvvo7k.fsf@laura> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Wed, 11 Oct 2023, Adhemerval Zanella Netto wrote: > On 11/10/23 15:30, Olivier Dion via Libc-help wrote: [...] >> However, looking at the following snippet in nptl/pthread_cond_wait.c: >> >> static __always_inline int >> __pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex, >> clockid_t clockid, const struct __timespec64 *abstime) >> { >> const int maxspin = 0; >> [...] >> /* Spin-wait first. [...] */ >> unsigned int spin = maxspin; >> while (signals == 0 && spin > 0) { >> [...] >> } >> [...] >> } >> > > Afaik it was added a placeholder for future extension, so fell free to > send a patch to delete it. [...] What about making it work instead? Would this be something to consider? IMHO it would be worth it. Having a fast-path that spins instead of taking the futex directly can greatly impact performance in some cases. In the meantime, I think it is safe to remove it. I'll send a patch on libc-alpha for that. Thanks, Olivier -- Olivier Dion EfficiOS Inc. https://www.efficios.com