From: "H.J. Lu" <hjl.tools@gmail.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: libc-alpha@sourceware.org, carlos@systemhalted.org
Subject: Re: [PATCH v1 1/2] linux: Implement sched_yield in C
Date: Wed, 7 Jun 2023 13:43:08 -0700 [thread overview]
Message-ID: <CAMe9rOqnUaTgYJH8QUOrRpKk=cvyNDQEscwxnaiX+L6h13eUzQ@mail.gmail.com> (raw)
In-Reply-To: <20230607194643.2081329-1-goldstein.w.n@gmail.com>
On Wed, Jun 7, 2023 at 12:46 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> This is in preperation for a minor optimization before expected
> context switches.
> ---
> sysdeps/unix/sysv/linux/sched_yield.c | 27 +++++++++++++++++++++++++++
> sysdeps/unix/sysv/linux/syscalls.list | 1 -
> 2 files changed, 27 insertions(+), 1 deletion(-)
> create mode 100644 sysdeps/unix/sysv/linux/sched_yield.c
>
> diff --git a/sysdeps/unix/sysv/linux/sched_yield.c b/sysdeps/unix/sysv/linux/sched_yield.c
> new file mode 100644
> index 0000000000..154bf725b0
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sched_yield.c
> @@ -0,0 +1,27 @@
> +/* Yield current process. Linux specific syscall.
> + Copyright (C) 2023 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <https://www.gnu.org/licenses/>. */
> +
> +#include <sysdep.h>
> +
> +int
> +__sched_yield (void)
> +{
> + return INLINE_SYSCALL_CALL (sched_yield);
> +}
> +libc_hidden_def (__sched_yield);
> +weak_alias (__sched_yield, sched_yield)
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index 73e941ef89..5f571df937 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -59,7 +59,6 @@ sched_primax - sched_get_priority_max i:i __sched_get_priority_max sched_get_pri
> sched_primin - sched_get_priority_min i:i __sched_get_priority_min sched_get_priority_min
> sched_setp - sched_setparam i:ip __sched_setparam sched_setparam
> sched_sets - sched_setscheduler i:iip __sched_setscheduler sched_setscheduler
> -sched_yield - sched_yield i: __sched_yield sched_yield
> setfsgid EXTRA setfsgid i:i setfsgid
> setfsuid EXTRA setfsuid i:i setfsuid
> setpgid - setpgid i:ii __setpgid setpgid
> --
> 2.34.1
Is this really needed? We can add x86-64 specific sched_yield.c.
--
H.J.
next prev parent reply other threads:[~2023-06-07 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 19:46 Noah Goldstein
2023-06-07 19:46 ` [PATCH v1 2/2] x86: Add `prepare_context_switch` to initialize register inuse states Noah Goldstein
2023-06-07 20:46 ` H.J. Lu
2023-06-07 21:59 ` Noah Goldstein
2023-06-08 9:01 ` Noah Goldstein
2023-06-07 20:43 ` H.J. Lu [this message]
2023-06-08 9:01 ` [PATCH v1 1/2] linux: Implement sched_yield in C Noah Goldstein
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='CAMe9rOqnUaTgYJH8QUOrRpKk=cvyNDQEscwxnaiX+L6h13eUzQ@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=carlos@systemhalted.org \
--cc=goldstein.w.n@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).