From patchwork Tue Jun 28 18:56:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12898760 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC99C43334 for ; Tue, 28 Jun 2022 19:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235149AbiF1TBu (ORCPT ); Tue, 28 Jun 2022 15:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233357AbiF1TAg (ORCPT ); Tue, 28 Jun 2022 15:00:36 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4425B1F2E5; Tue, 28 Jun 2022 12:00:25 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id ej4so18911320edb.7; Tue, 28 Jun 2022 12:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ox9QeHiY6HWuPvJfgNGG6WaFTtO2T886numczpXJZTA=; b=bMbLJIsrR1Tb7cS5HHG5VF8QBma2TQ+bPnX0ptlXlGNl15a7RnZiH9s+R1YKDUQw4n 8K5th81a4IF76rwDN7Ww1IAcC80o42i9cViirk4ByviNLaTkbbZ9HzY60t0fgu+djiUl 8P4KdTeNmUyKmELfCW7GZWcwqDon1btdcbMCVxXAWfe0U7KHH98LoxfC8PJQHHozqw/+ CKR9b4ET8hgLBZWaBM2dfXRuOVToAUvI5dzntOFJaIdyE/kBvE311KHnLfXPy8mWURVn DMrQQhm5cSO3c0UF/AUpfYdSr9x/y/JlqQNJOVuQxifojkyATP1ZI+XjdZ3AW4tZl4G8 nl0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ox9QeHiY6HWuPvJfgNGG6WaFTtO2T886numczpXJZTA=; b=e33BnT1Fq23r/2sW6xzw40fwH5TzeE0WFjiEZT7PUpv92uw/Hs3S86FIqaQ4OWBHub 5UPue28qIrrY4hIyCtxMuRSe0XKGqZmFjpzUptXczhD1kUemWCDhGYEOwrntgG+aW81k 6EAOBC5kCXxQo5+ozAKQU4YSePmsG5SjHLL2iOtyEzS/hIPr7irpCKJZuiRmgnZHTmkr lpkkF2lpZOF8uKVpaqb4sGQ6uxhHJZMVzv7qc95t5TCeyDhY7LiZ+AdDbEq9PUvTHDcu hoPsxWZjY1fYzbkR2HbFWNW4+kD6huj94Va5x88/ZW04blcKl77iMESoWoxq1yg4rq91 bupA== X-Gm-Message-State: AJIora+uMiCFfVR+fodOWUo4olXcphCIBsGHOkvtZPQqIFkS+chOmF0G R3DPh74Nb3yCDbsgm90LR0m8l9WHF9Mw6g== X-Google-Smtp-Source: AGRyM1t6UXVD+LJFLiumTBQ1UH4oWqirtexXfZOToprQudgOKXHuHIJBoJDZGrflt4qFX8gvCKC6dA== X-Received: by 2002:a05:6402:4386:b0:437:6450:b41f with SMTP id o6-20020a056402438600b004376450b41fmr25035456edc.97.1656442823586; Tue, 28 Jun 2022 12:00:23 -0700 (PDT) Received: from 127.0.0.1localhost (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id t21-20020a05640203d500b0043573c59ea0sm9758451edw.90.2022.06.28.12.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 12:00:23 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "David S . Miller" , Jakub Kicinski , Jonathan Lemon , Willem de Bruijn , Jens Axboe , kernel-team@fb.com, Pavel Begunkov Subject: [RFC net-next v3 26/29] io_uring: flush notifiers after sendzc Date: Tue, 28 Jun 2022 19:56:48 +0100 Message-Id: X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Allow to flush notifiers as a part of sendzc request by setting IORING_SENDZC_FLUSH flag. When the sendzc request succeedes it will flush the used [active] notifier. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 7 +++++-- include/uapi/linux/io_uring.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 70b1f77ac64e..f5fe2ab5622a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6581,7 +6581,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) return 0; } -#define IO_SENDZC_VALID_FLAGS IORING_SENDZC_FIXED_BUF +#define IO_SENDZC_VALID_FLAGS (IORING_SENDZC_FIXED_BUF|IORING_SENDZC_FLUSH) static int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { @@ -6685,7 +6685,10 @@ static int io_sendzc(struct io_kiocb *req, unsigned int issue_flags) msg.msg_ubuf = ¬if->uarg; ret = sock_sendmsg(sock, &msg); - if (unlikely(ret < min_ret)) { + if (likely(ret >= min_ret)) { + if (req->msgzc.zc_flags & IORING_SENDZC_FLUSH) + io_notif_slot_flush_submit(notif_slot, 0); + } else { if (ret == -EAGAIN && (issue_flags & IO_URING_F_NONBLOCK)) return -EAGAIN; if (ret == -ERESTARTSYS) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 69100aa71448..7d77d90a5f8a 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -279,6 +279,7 @@ enum { */ enum { IORING_SENDZC_FIXED_BUF = (1U << 0), + IORING_SENDZC_FLUSH = (1U << 1), }; /*