From: Samuel Thibault <samuel.thibault@gnu.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org
Subject: Re: [PATCH 3/7] hurd: Mark various conditions as unlikely
Date: Sat, 29 Apr 2023 16:53:22 +0200 [thread overview]
Message-ID: <20230429145322.dxo2tebi7cwyel6q@begin> (raw)
In-Reply-To: <20230429131354.2507443-3-bugaevc@gmail.com>
Applied, thanks!
Sergey Bugaev, le sam. 29 avril 2023 16:13:50 +0300, a ecrit:
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
> 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
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
next prev parent reply other threads:[~2023-04-29 14:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-29 13:13 [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit Sergey Bugaev
2023-04-29 13:13 ` [PATCH 2/7] hurd: Move libc_hidden_def's around Sergey Bugaev
2023-04-29 14:52 ` Samuel Thibault
2023-04-29 13:13 ` [PATCH 3/7] hurd: Mark various conditions as unlikely Sergey Bugaev
2023-04-29 14:53 ` Samuel Thibault [this message]
2023-04-29 13:13 ` [PATCH 4/7] hurd: Make _exit work during early boot-up Sergey Bugaev
2023-04-29 14:54 ` Samuel Thibault
2023-04-29 13:13 ` [PATCH 5/7] hurd: Don't leak the auth port in msg* RPCs Sergey Bugaev
2023-04-29 14:56 ` Samuel Thibault
2023-04-29 13:13 ` [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd Sergey Bugaev
2023-04-29 14:57 ` Samuel Thibault
2023-04-29 13:13 ` [PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling Sergey Bugaev
2023-04-29 15:01 ` Samuel Thibault
2023-04-29 14:50 ` [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230429145322.dxo2tebi7cwyel6q@begin \
--to=samuel.thibault@gnu.org \
--cc=bug-hurd@gnu.org \
--cc=bugaevc@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).