From patchwork Wed Jun 7 19:46:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 70755 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7249C3856DD5 for ; Wed, 7 Jun 2023 19:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7249C3856DD5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686167236; bh=N4Lhd8bPw1qWghbhPOcCyxlTEO1u5bHRX+0h+A0nLSQ=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=LUxrnWVf5D+DOqc3RrnI8bro56sjU0aU6ww7+p0DPnKcPP1nbOhLhYfKwXbSliq5E 5S+06sZmkuQwqyrutEC1HCEDVXxHp9vUlJde+JEySCQivQLVnlIkv8+cjAMYInYvrN n/kF0zOvK70iAB7O/XSzPV/RhOHAqtCNY7TxdITU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id AB9263858C1F for ; Wed, 7 Jun 2023 19:46:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB9263858C1F Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-977d55ac17bso716052066b.3 for ; Wed, 07 Jun 2023 12:46:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686167213; x=1688759213; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N4Lhd8bPw1qWghbhPOcCyxlTEO1u5bHRX+0h+A0nLSQ=; b=HFLwCmi8ry0cxTuGF1LxK8BowtlkKCioAFb2KeH8CSuPoXkDNcpmFc1iXRCQ1SIirf dFbPgP7OcIhKMvK94dv/PCYG3hxrVqoyOQsxWrtga5/Lo8lk5hAj/jq6BRMTkEZjvaNJ FSBV+1DuN3xuRxGM0DtNwPn5iubNahPvoPg9jmkFrE6CrR1/CkMM/tphTmeokxddxuWJ otFWslp9GsJxztf+IxniHqvvP/9om1CV2TsyDFR+uu9WoclrcLwnpVbnsdxwRFVTfVe0 UXTI8j6KGH1UkMaX5JXFXADsNBxfOL+GDJcRip8wUE7SfwvEHkEAqQq2sAIwcLkLvAW7 OGPw== X-Gm-Message-State: AC+VfDxUjErznfGKXUrZLHCb5kXRhGWGntN4+8wJg6mXkhqEktsD1PvH IFjdMUykn/3iRmviFd3YT4IgXY/TBzU= X-Google-Smtp-Source: ACHHUZ5aB0pkKldp6tNJYkQ6VMKtcBPgJBL90mHePwzDgERqlBCs32KtqYf4z90wxkrhjYGCD8Zp/A== X-Received: by 2002:a17:907:3189:b0:974:c32c:b484 with SMTP id xe9-20020a170907318900b00974c32cb484mr6507415ejb.72.1686167212666; Wed, 07 Jun 2023 12:46:52 -0700 (PDT) Received: from noahgold-desk.intel.com (2603-8080-1301-76c6-bbb0-ef3c-a689-4ab7.res6.spectrum.com. [2603:8080:1301:76c6:bbb0:ef3c:a689:4ab7]) by smtp.gmail.com with ESMTPSA id y1-20020a1709064b0100b00978874e833bsm919130eju.168.2023.06.07.12.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 12:46:52 -0700 (PDT) To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: [PATCH v1 1/2] linux: Implement sched_yield in C Date: Wed, 7 Jun 2023 14:46:42 -0500 Message-Id: <20230607194643.2081329-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 + . */ + +#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/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