public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Mark various conditions as unlikely
@ 2023-04-29 14:53 Samuel Thibault
0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-04-29 14:53 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a9fb57105e9abd7919478226ee802270d1b3b9df
commit a9fb57105e9abd7919478226ee802270d1b3b9df
Author: Sergey Bugaev <bugaevc@gmail.com>
Date: Sat Apr 29 16:13:50 2023 +0300
hurd: Mark various conditions as unlikely
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230429131354.2507443-3-bugaevc@gmail.com>
Diff:
---
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 f6139544c5..4727535137 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 b8af6f289a..89cf7ac87c 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -254,9 +254,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. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-29 14:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 14:53 [glibc] hurd: Mark various conditions as unlikely Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).