From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id B39933858C60 for ; Sat, 29 Apr 2023 13:13:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B39933858C60 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-lf1-x132.google.com with SMTP id 2adb3069b0e04-4efe8991bafso1180919e87.0 for ; Sat, 29 Apr 2023 06:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682774038; x=1685366038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p1L8QPGACgmes4wtZgddLp/fG1aOjQ4PWzv8KkAi66Q=; b=qb6nCrITDA89lmQzgM/Sv/dJqn3tXdJAApUt+0+V7Olt6oChPM5dIgKISIpabn36cQ 0Nfg5oOzSm6hwsPFmQ1/NPUkza0rhRuBuM3ijI9Lh+Jlpcl91eFb7qD4V6h6bi554GUq +up4D2DX68U8nOX1olBZi23LmPXk8XYBXFqohVHBTWmC0IYbhsoKXK7fd1pKF2xHUzkv jn1bkODDXy9+/x1C/FFVDcYz2P0KGqgOVpOqnAweJgCkE/l8pKxK3PQkiD09QLb4M2Gv LDmyHT8d8ATtuZJME7BDvlR7+1skLTW2M4zhNcPgiMBCjfPeDJsWdGohO9ietvW21uRQ vcww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682774038; x=1685366038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p1L8QPGACgmes4wtZgddLp/fG1aOjQ4PWzv8KkAi66Q=; b=kjJyl+vkKcgpcwIi4HcvZbitIRKlNxmebwL1DtvGgtfFXO9dUWKI7mSq3whKVQXe/I QZnwzCpVtHqohAMwmorYnC6uTbjDg0jNZ6fmTUPD0x8uYoVxr0/yfCUbCZa8CrLmqftW rWEAJY0CbQ6ZzANH8Rie+iHdC/v8G8k6YeMHRhXngJ6PYvJdCn6l7ygu2DFOI8L+4RD1 31kXPfaMVR5G7wOF1Fh5cvR6mtCw7ATXf3yl/3t6UGVf18BZ9eutIxkR4k7PsW1kMNBe kT69EVe0DPMZlp1zoGtogNlVwxubEdl1BYrW870AQkvnk/i0XQsL1Azu6tcYwwxvOhsd 4aqQ== X-Gm-Message-State: AC+VfDxjWjNOjdvYSQfys/6BFNJ20JC5fcO9P9KnOiCVyabEcR/+xMNp +tInheqoZgk3VSYXv8KIssozLTxgY/7Tog== X-Google-Smtp-Source: ACHHUZ7Rp8VALfhw0GE6Wv6p+3RW1VHicnp/JFrV5ocs260F3yFf6KOUw6v5F8vOl4P9M7V3IzASAg== X-Received: by 2002:ac2:48b3:0:b0:4ec:7967:9e8a with SMTP id u19-20020ac248b3000000b004ec79679e8amr2255305lfg.16.1682774037841; Sat, 29 Apr 2023 06:13:57 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:8a14:19ba:9e6b:1866]) by smtp.gmail.com with ESMTPSA id f27-20020ac251bb000000b004eb018fac57sm3744851lfk.191.2023.04.29.06.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Apr 2023 06:13:57 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org Cc: bug-hurd@gnu.org, Samuel Thibault Subject: [PATCH 3/7] hurd: Mark various conditions as unlikely Date: Sat, 29 Apr 2023 16:13:50 +0300 Message-Id: <20230429131354.2507443-3-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230429131354.2507443-1-bugaevc@gmail.com> References: <20230429131354.2507443-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: Signed-off-by: Sergey Bugaev --- hurd/hurd/fd.h | 10 +++++----- hurd/hurd/signal.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index 241797bf..824b7dbb 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -73,18 +73,18 @@ _hurd_fd_get (int fd) HURD_CRITICAL_BEGIN; __mutex_lock (&_hurd_dtable_lock); - if (fd < 0 || fd >= _hurd_dtablesize) + if (__glibc_unlikely (fd < 0 || fd >= _hurd_dtablesize)) descriptor = NULL; else { struct hurd_fd *cell = _hurd_dtable[fd]; - if (cell == NULL) + if (__glibc_unlikely (cell == NULL)) /* No descriptor allocated at this index. */ descriptor = NULL; else { __spin_lock (&cell->port.lock); - if (cell->port.port == MACH_PORT_NULL) + if (__glibc_unlikely (cell->port.port == MACH_PORT_NULL)) /* The descriptor at this index has no port in it. This happens if it existed before but was closed. */ descriptor = NULL; @@ -107,7 +107,7 @@ _hurd_fd_get (int fd) #define HURD_FD_USE(fd, expr) \ ({ struct hurd_fd *descriptor = _hurd_fd_get (fd); \ - descriptor == NULL ? EBADF : (expr); }) + __glibc_unlikely (descriptor == NULL) ? EBADF : (expr); }) /* Evaluate EXPR with the variable `port' bound to the port to FD, and `ctty' bound to the ctty port. */ @@ -125,7 +125,7 @@ _hurd_fd_get (int fd) io_t port, ctty; \ void *crit = _hurd_critical_section_lock (); \ __spin_lock (&__d->port.lock); \ - if (__d->port.port == MACH_PORT_NULL) \ + if (__glibc_unlikely (__d->port.port == MACH_PORT_NULL)) \ { \ __spin_unlock (&__d->port.lock); \ _hurd_critical_section_unlock (crit); \ diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index 302ca25e..8a547fd0 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -249,9 +249,9 @@ _hurd_critical_section_unlock (void *our_lock) sigset_t pending; _hurd_sigstate_lock (ss); __spin_unlock (&ss->critical_section_lock); - pending = _hurd_sigstate_pending(ss) & ~ss->blocked; + pending = _hurd_sigstate_pending (ss) & ~ss->blocked; _hurd_sigstate_unlock (ss); - if (! __sigisemptyset (&pending)) + if (__glibc_unlikely (!__sigisemptyset (&pending))) /* There are unblocked signals pending, which weren't delivered because we were in the critical section. Tell the signal thread to deliver them now. */ -- 2.40.1