Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38487940rwd; Wed, 12 Jul 2023 08:17:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOpgbkeYoxgeyCIuYvJJX2VF8tdNPiTAhcNvs89tRu00qIsssRxvkDKyhVb0G3Z4rou/Zb X-Received: by 2002:a17:906:cf83:b0:992:bc8:58d9 with SMTP id um3-20020a170906cf8300b009920bc858d9mr17720205ejb.70.1689175077182; Wed, 12 Jul 2023 08:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689175077; cv=none; d=google.com; s=arc-20160816; b=j97JUZhtAcz/mpGjk420cwBOr+XZ6taSFwKXT7R//0m4256o67m4OSJUiTpHh6OKj0 64pDGPYZ7ctVxEjLCQ1y1irA52qiPfG4KhYPuWzKpbu2ViHIKrVC5ob5sWvTleKobgvs Ggrkj3jf1mBtpRozWRxgj4HeLUujcvzC+t20JiuUO60Sht9ZdMCdn+eBSrPCTN81xrOY K+AB2ULZNtJHf5yPvBSX+HI4jaaV025BvDEz0NoNUsHK6OJGfasvVz9mEyi0YYpkcAOK QdRGaikyxIUWF6pK1qTbIaJ4JQGV5GKemFCRpLvhzEWfYr0duek0Fk5rtFp31AU5GsAK NJJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Wj4QF04GqhfOXgZJMhxX0dNs4/SeSh8zekCeq3JhY6c=; fh=zDHiJ0kFpW3lAEi2K3Zd8w7xUXEAhFG68V2N8ulvU8k=; b=FMxNbRAEQ0RYXt6mOZatiUDgJ+18S90CenwGNNx6cmZFSQzswdqxAbX7bfAEI9VuvS mmNYKd+tbCQk5JijDdSrGoXQHfUq5mZQ7m9O5ejPMAinGAis4LXfgLxiR9eA0Htde7uB dovgXQCS6tK39+BA31gjgCqvZ1yLE05AIhEY00tQuY0Gj4BKpO57NWJyrMaKDLzgbhz0 6XXjNeRcuseVgpGa8hxdFO0IQJJze+txI/ijaGdqwG6nQwB96eKJ+96rBxuMH2Yu3/jb 4Aa4qzAuCSKRMByrhFow3UeT4IVKoZHQSk/7jFeJEb5UX604HzohjPIyU62giQqfLIR/ uRSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b="eKp/sXs6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a170906060d00b009877bb42154si4896853ejb.465.2023.07.12.08.17.32; Wed, 12 Jul 2023 08:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b="eKp/sXs6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbjGLPKr (ORCPT + 99 others); Wed, 12 Jul 2023 11:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbjGLPKp (ORCPT ); Wed, 12 Jul 2023 11:10:45 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B231BE2 for ; Wed, 12 Jul 2023 08:10:26 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-346636b9761so2916535ab.0 for ; Wed, 12 Jul 2023 08:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1689174624; x=1691766624; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Wj4QF04GqhfOXgZJMhxX0dNs4/SeSh8zekCeq3JhY6c=; b=eKp/sXs6Ml16YA4OH/lW4DNToyGScZHnMnfPYDFmhHAQgA2lAGDlOM25FFJEO8L+7A YgCULt/hhJ6QiwITARC9bKlXBI7jTuU4Wii5cj8JR+cOMVeDRzoYHl2iP66U9RVNVHB5 Kw6tF8MMDal1eg8hFM6Ul1Oke6Q54fCx556iUuIKUT+TI/bhFaCqyeKAZ8aLIf2HQiU4 oS+1Natvid4McB1vsKSOu0U/NOpwQ6eKpp5N3mXpDdrPJ7LhIbneOy0b0BUkiic+5ZHJ yeA6jq/LQHAbtOzLKsallr8luwe4DrXI7eH+WgqZ9ODOOaNh6/uVdpViuVokMniUEXKd sQyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689174624; x=1691766624; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wj4QF04GqhfOXgZJMhxX0dNs4/SeSh8zekCeq3JhY6c=; b=k9HtmFOxiHl3LqOaOGMBxTSnde3LoFCkL4hIS6Que/vlR+8h4NkkmojP/Gn7+snUHz czYXWU2rWjQTFunXzyWEXYa6jCvgnw5Cr8CvsGRdItTWVi0GO1SOjP0/6KggiBfUg4T8 SDU087szQ1/bAgS6hFR95/2QE9/Ev2ZQsKBZ48YT+IRu2o3P4vNljy6ZHgFq0XTymBrc pe8XqNv0RXSr6L68Kd/Tl0kRd0ANhJcEAW8WbnugNB6ig1EiE/RPLGI6vKhyKdDrm+Xf CUfhQEBPhcsQzZgOo4nm6pN17cotsxpxvAONaf5pzNkHdEr7o2uqMOzNxfRP8YAMp5FI RvKA== X-Gm-Message-State: ABy/qLaDtAJPJjwmzi0SysB0qupXAhZiWZQKr8WmC4PVCbBBLszzSpo4 etK8uAJE7Aheda31+Ts8+xEufg== X-Received: by 2002:a05:6e02:e04:b0:345:e438:7381 with SMTP id a4-20020a056e020e0400b00345e4387381mr15577306ilk.2.1689174623958; Wed, 12 Jul 2023 08:10:23 -0700 (PDT) Received: from [192.168.1.94] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id i15-20020a92c94f000000b003460bb48516sm1368429ilq.67.2023.07.12.08.10.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jul 2023 08:10:23 -0700 (PDT) Message-ID: <0ffd2e2f-a179-393b-bd0d-cd62a41ecb92@kernel.dk> Date: Wed, 12 Jul 2023 09:10:22 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 7/7] io_uring: add futex waitv Content-Language: en-US To: Peter Zijlstra Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com References: <20230712004705.316157-1-axboe@kernel.dk> <20230712004705.316157-8-axboe@kernel.dk> <20230712093152.GF3100107@hirez.programming.kicks-ass.net> From: Jens Axboe In-Reply-To: <20230712093152.GF3100107@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 7/12/23 3:31?AM, Peter Zijlstra wrote: > On Tue, Jul 11, 2023 at 06:47:05PM -0600, Jens Axboe wrote: >> Needs a bit of splitting and a few hunks should go further back (like >> the wake handler typedef). >> >> WIP, adds IORING_OP_FUTEX_WAITV - pass in an array of futex addresses, >> and wait on all of them until one of them triggers. >> > > So I'm once again not following. FUTEX_WAITV is to wait on multiple > futexes and get a notification when any one of them wakes up with an > index to indicate which one. Right > How exactly is that different from multiple FUTEX_WAIT entries in the > io_uring thing itself? Admittedly I don't actually know much of anything > when it comes to io_uring, but isn't the idea that queue multiple > 'syscall' like things and get individual completions back? > > So how does WAITV make sense here? You most certainly could just queue N FUTEX_WAIT operations rather than a single FUTEX_WAITV, but it becomes pretty cumbersome to deal with. First of all, you'd now get N completions you have to deal with. That's obviously doable, but you'd probably also need to care about cancelations of the N-1 FUTEX_WAIT that weren't triggered. For those reasons, I do think having a separate FUTEX_WAITV makes a lot more sense. It's a single request and there's no cleanup or cancelation work to run when just one futex triggers. Tongue in cheek, but you could also argue that why would you need futex waitv support in the kernel, when you could just have N processes wait on N futexes? We can certainly do that a LOT more efficiently with io_uring even without FUTEX_WAITV, but from an efficiency and usability point of view, having FUTEX_WAITV makes this a lot easier than dealing with N requests and cancelations on completion. -- Jens Axboe