Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3574774rdh; Thu, 28 Sep 2023 16:31:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzugeQUMx/QL17XSJcmQo9TY72zz2Mu3HTChDqycTlOQhLVHU0ZNBzcO8qBXxhQh5YR/H7 X-Received: by 2002:a05:6830:6b0c:b0:6c4:da36:f949 with SMTP id db12-20020a0568306b0c00b006c4da36f949mr2933948otb.8.1695943865242; Thu, 28 Sep 2023 16:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695943865; cv=none; d=google.com; s=arc-20160816; b=CH6rq2/2TzXzy8uYihIOyrSFh+dyaLyjDRv4wMrH6GHzaP8Hzg6AH4SnTOWNQZvBQh q0hr4C9OPGaoHGOQPUZD1iOC3Hf+3zdfrm++nVgAZRXCzzlQsX0yiHZmuFI/lU9GCFcp 2wf9/pTsWhhEVqGXLq0WlkdBoNc16tEU/uAI1yQlIbrS3zCnc2S9CiH4PtXmbE2O60f5 EqTBCFVbcWRa3sbwyxjoa+70+egP9tsLlA86phIUFF4M+P/5GIls87I0f6Xz6xbhN+IL lr3i1/gduzyDFlOTHA5t9fYBPXxe2OktD8v8vzw4t/QEggmYQdgSiYmdNZcPNgrHVR2B bLtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dMx5R6E0R0h9+pd+QZi7bIoYwQS8EWnvSyRr5gNA3m0=; fh=McWMhBXbZKPJudkA+aRuAP3u2dQeraI6k1jPJeJNhbk=; b=rmpTi50rRrE5EgSrKOfhixVvU+5eseByjqlfoiRPjwr5Wt/LpRjDssxA6KMG7z/8+w XgtWWeTEQB654j5qqkDaX6jUmVlGAa7/vBXfSNvFRhELa2thQjOUasv3ckusGRm7aWRr xsK/iXVFc5nHS4oFs1CtBI1a9AGOMMvGcD3/AdGCZc+qoBVXTYsi+gmzcn1Z96ui4kk6 SLKpSsfMfQ5n0o/AmJeNpx9lBg1eP0MjfRY94HpibZURqOdgoRGx3SQRG5ruWhSfLjHp nrz7VFNbC50GXm6cG/OwD5vkGO38CT6WAWuyjSft6TUMTceO0b3vsbym08T/fMrblkQH EQPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=x5KmuZol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bw21-20020a056a00409500b0068a49a550b9si19668236pfb.139.2023.09.28.16.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 16:31:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=x5KmuZol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 31BC280C921A; Thu, 28 Sep 2023 10:26:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbjI1RZ4 (ORCPT + 99 others); Thu, 28 Sep 2023 13:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjI1RZi (ORCPT ); Thu, 28 Sep 2023 13:25:38 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AB421BE for ; Thu, 28 Sep 2023 10:25:35 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9ae3d7eb7e0so355435666b.0 for ; Thu, 28 Sep 2023 10:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1695921933; x=1696526733; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dMx5R6E0R0h9+pd+QZi7bIoYwQS8EWnvSyRr5gNA3m0=; b=x5KmuZolHfI6zmMIvBkqCBB0NojKGYm/Ej/lsp06NKUeAtEv3Axen0d35ZtfRu2/YL 93crRONQeATlgUnZBlr6Sy52uIdIdTs6B9Fx+NiJrmJ0mibrbtEK9l4YYNY7Il4q+njd OxJQTtMb7L6UIQcU0wSBRJ02NNFh4twwp4Dt8kRDAaJlWoa+hAdykwZBoN2w38iltlAN y8+Lc4o1+QVgA2Oc7vqliXG/OuMbCOheRMrF5glK9DBZexIYUfavQV4Tox6nNgE4HBZZ E7S64ApXCTyIRVbqaU0i6gSdk1KERTeEjpsGWEELiuUfhTwfckiJoYB+jDXGKLkH0Aii nw5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695921933; x=1696526733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dMx5R6E0R0h9+pd+QZi7bIoYwQS8EWnvSyRr5gNA3m0=; b=cAElLDJXmsfOzz1fTJ7hBNmfSZxwZ+jF+wkWMG/tnBas241MzksTPJb8KQb6gMbA4l cu534wPndF48AgPPX6WDauBPTbO+7N1DKwn3ayeyarMm6brHs9KFbqI7K1CRKlnYedm2 lJJm2S9ahhf8av8lWOpcrkJ3HifLcc5TyiKEOaqwMNiDssY2JXcDq3314j5NwrkhyqyG GL1goMhF3vWkPiIX1mzIKhNlV0MRGAVWA+BBuQh5mZi+rGZ06WWRsh2ju4HKbp7tFtx3 ZPb/paf30OhVPWV8om1v47mVsb2zSMCn+/b5MxZeXonFmA0Rfl2fGqlfbq/+/jf66bxo FkRA== X-Gm-Message-State: AOJu0YyDnTLm2KkmzTxKnXUTgFm8yY8UsbCYt+NKJypcTC/6Em4s/Zsy /3WFHmuO6rVJ64LH1pL8G3PJUw== X-Received: by 2002:a17:906:25d:b0:9b2:bf2d:6b65 with SMTP id 29-20020a170906025d00b009b2bf2d6b65mr2106678ejl.4.1695921933527; Thu, 28 Sep 2023 10:25:33 -0700 (PDT) Received: from localhost.localdomain ([45.147.210.162]) by smtp.gmail.com with ESMTPSA id j17-20020a170906279100b0099329b3ab67sm11151788ejc.71.2023.09.28.10.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 10:25:32 -0700 (PDT) From: Jens Axboe To: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Cc: peterz@infradead.org, andres@anarazel.de, tglx@linutronix.de, Jens Axboe Subject: [PATCH 7/8] futex: make the vectored futex operations available Date: Thu, 28 Sep 2023 11:25:16 -0600 Message-Id: <20230928172517.961093-8-axboe@kernel.dk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928172517.961093-1-axboe@kernel.dk> References: <20230928172517.961093-1-axboe@kernel.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 10:26:04 -0700 (PDT) Rename unqueue_multiple() as futex_unqueue_multiple(), and make both that and futex_wait_multiple_setup() available for external users. This is in preparation for wiring up vectored waits in io_uring. Signed-off-by: Jens Axboe --- kernel/futex/futex.h | 5 +++++ kernel/futex/waitwake.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/futex/futex.h b/kernel/futex/futex.h index 6b6a6b3da103..8b195d06f4e8 100644 --- a/kernel/futex/futex.h +++ b/kernel/futex/futex.h @@ -366,6 +366,11 @@ extern int futex_parse_waitv(struct futex_vector *futexv, unsigned int nr_futexes, futex_wake_fn *wake, void *wake_data); +extern int futex_wait_multiple_setup(struct futex_vector *vs, int count, + int *woken); + +extern int futex_unqueue_multiple(struct futex_vector *v, int count); + extern int futex_wait_multiple(struct futex_vector *vs, unsigned int count, struct hrtimer_sleeper *to); diff --git a/kernel/futex/waitwake.c b/kernel/futex/waitwake.c index 6fcf5f723719..61b112897a84 100644 --- a/kernel/futex/waitwake.c +++ b/kernel/futex/waitwake.c @@ -372,7 +372,7 @@ void futex_wait_queue(struct futex_hash_bucket *hb, struct futex_q *q, } /** - * unqueue_multiple - Remove various futexes from their hash bucket + * futex_unqueue_multiple - Remove various futexes from their hash bucket * @v: The list of futexes to unqueue * @count: Number of futexes in the list * @@ -382,7 +382,7 @@ void futex_wait_queue(struct futex_hash_bucket *hb, struct futex_q *q, * - >=0 - Index of the last futex that was awoken; * - -1 - No futex was awoken */ -static int unqueue_multiple(struct futex_vector *v, int count) +int futex_unqueue_multiple(struct futex_vector *v, int count) { int ret = -1, i; @@ -410,7 +410,7 @@ static int unqueue_multiple(struct futex_vector *v, int count) * - 0 - Success * - <0 - -EFAULT, -EWOULDBLOCK or -EINVAL */ -static int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *woken) +int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *woken) { struct futex_hash_bucket *hb; bool retry = false; @@ -472,7 +472,7 @@ static int futex_wait_multiple_setup(struct futex_vector *vs, int count, int *wo * was woken, we don't return error and return this index to * userspace */ - *woken = unqueue_multiple(vs, i); + *woken = futex_unqueue_multiple(vs, i); if (*woken >= 0) return 1; @@ -557,7 +557,7 @@ int futex_wait_multiple(struct futex_vector *vs, unsigned int count, __set_current_state(TASK_RUNNING); - ret = unqueue_multiple(vs, count); + ret = futex_unqueue_multiple(vs, count); if (ret >= 0) return ret; -- 2.40.1