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: 1791889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Gm2M6M22; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QbyXv3Qc1z20WP for ; Thu, 8 Jun 2023 05:47:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A21D3858C1F for ; Wed, 7 Jun 2023 19:47:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A21D3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686167229; 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=Gm2M6M22c/UrJ2Ouf7SbOzGn8TSxY9Qbyt3Ky/W6ztaMVZ+4Rl26GQL0uILu+jkWD RtzhYBKoxZIld6+GitT67KugbCEaVoJFkzWiYUmqaFGah6IwmmCrotpDGpU9uk3k1P c8PXgqDn4uMpm9eqbega0sB8NP/gRblmNW/GNqq8= 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+incoming=patchwork.ozlabs.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