From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by sourceware.org (Postfix) with ESMTPS id 05E5B3858C54 for ; Wed, 7 Jun 2023 20:43:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05E5B3858C54 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-yw1-x1136.google.com with SMTP id 00721157ae682-561b7729a12so15691227b3.1 for ; Wed, 07 Jun 2023 13:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686170624; x=1688762624; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HTLoLwFI3qi0fz82m9rUChZFxV1Akcixa/cHLQWzc0M=; b=Ml8suUpZJALQBqoiIVi6mOzopJxUwKPmy0TbiLokVRP+QGiVIc6v+Lw+c5YNgBFicR H4PguRj4VRRbSLdA7ug6DlCgwTBGFyYgWJz6xDGXvmZJapz744pwR0nUJpWtdrf9qG9i GpreUQppaka0O3bpt109rTUbf+W11s12eGvPVt61c1FF+FmoTFs/4d6OlQk/C38KJREb vcmhFbkbS48Z3+8RdpoIqLPkbE6dKmfkuVrVZEmvOw+hvLzetKtZw1QhzI6TefMenKdR 8oZJhJBknbsC+BQuOXFVjdqvANd9rcCMxBGSELM1XLMNM6a8Nt2MPmPTg18mOsHVS35B K/4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686170624; x=1688762624; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HTLoLwFI3qi0fz82m9rUChZFxV1Akcixa/cHLQWzc0M=; b=TUyflLgG0a0gsRHMAG+OiYjeYVfGq2Y9MFXu+rlo4KqJqx9+OGX9Y792svB2ux1wMT /fj2h+f4BhU/DPQ9TuzKSeZNVPr/7uGYBWdZ3jcx7D/aN90ycZsLmrtt2RDEBww3dzkt X0MzM+oAUI1D+cAm07ZqDntfZRkL3Ef2HutJiYHc/WhhjOR6/ZFoXvk+bzikldvDo7mX 9+7z8wLWz55IjeVGNXD3eF8D0dt/1quJeZFI6dOFDuVgdNI+vtYs1J8Kz4jUcVABhoVe hfXwBlEid2TdjR+gMwDghRDHKhy4w/AR0SNAWrV4wm33etrtvMK56DjdKleiKSJoVOTV mUpg== X-Gm-Message-State: AC+VfDwTp/7qcUaPe3WlYph9eoNQcTjFhaRxuYB/lfMOT8zT9jc8lzBH 6IXl3XIbKJ6APXaiVar9FYEzRoi2eGG3NEjI0c4= X-Google-Smtp-Source: ACHHUZ4xPHZfwe7kZY4tOoEKB2URbN4c1w+3B919fnQpqEF/2bIzH5Yp4791ykOeVm5PBanTrxKdkOOhGMdse5qf3XQ= X-Received: by 2002:a0d:e64a:0:b0:559:d78f:db64 with SMTP id p71-20020a0de64a000000b00559d78fdb64mr270741ywe.3.1686170624216; Wed, 07 Jun 2023 13:43:44 -0700 (PDT) MIME-Version: 1.0 References: <20230607194643.2081329-1-goldstein.w.n@gmail.com> In-Reply-To: <20230607194643.2081329-1-goldstein.w.n@gmail.com> From: "H.J. Lu" Date: Wed, 7 Jun 2023 13:43:08 -0700 Message-ID: Subject: Re: [PATCH v1 1/2] linux: Implement sched_yield in C To: Noah Goldstein Cc: libc-alpha@sourceware.org, carlos@systemhalted.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3021.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,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: On Wed, Jun 7, 2023 at 12:46=E2=80=AFPM Noah Goldstein 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/li= nux/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 > + . */ > + > +#include > + > +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/li= nux/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_prior= ity_min sched_get_priority_min > sched_setp - sched_setparam i:ip __sched_setparam s= ched_setparam > sched_sets - sched_setscheduler i:iip __sched_setschedu= ler sched_setscheduler > -sched_yield - sched_yield i: __sched_yield sched_yie= ld > setfsgid EXTRA setfsgid i:i setfsgid > setfsuid EXTRA setfsuid i:i setfsuid > setpgid - setpgid i:ii __setpgid s= etpgid > -- > 2.34.1 Is this really needed? We can add x86-64 specific sched_yield.c. --=20 H.J.