From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB084C433B4 for ; Thu, 15 Apr 2021 12:45:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C9E761249 for ; Thu, 15 Apr 2021 12:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbhDOMp3 (ORCPT ); Thu, 15 Apr 2021 08:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232862AbhDOMp2 (ORCPT ); Thu, 15 Apr 2021 08:45:28 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0760C061574 for ; Thu, 15 Apr 2021 05:45:05 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id t14-20020a05600c198eb029012eeb3edfaeso2186199wmq.2 for ; Thu, 15 Apr 2021 05:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=aFkPp9UH9blMlsAgNdq8eosYxVPgglMZQQzElkxIn+A=; b=FR2s5HbOKjsV2/w446AhPkh5RURDEcOPQp9qOqc5A4e2Jz3hD6BtY+PwKDaIN8BCET zSt2pMrnCQc8ufx8QXU8ipSHOzSGrHVU87KOs5cjv+N7gI+rmFesJjhmc6gf8x6Cn3Ij dYp6CFIiqelow4a6Ch5sSf0cT/QQJNr6LWnW3ZYCyxxhvMYbRaKjDkm9TDiJfJQc5oId 7Imup74KBC/W7qv2nvQexN1dZ1bPoLDj/FyV+bxnPkmI+q529p0cBGj1tm6D5AuoJCJg XXycI+poE7J/ycLvgHUOp5hgqUHuTyyHIG8+Xs+DR3U99uDhnRDFG4K57+OOTT2FdQTD ++Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=aFkPp9UH9blMlsAgNdq8eosYxVPgglMZQQzElkxIn+A=; b=Pr/5a0mo/NhTns74rQ9CRbkz3hH+7SutiFxvXMScP/gkL3fzC/BLLg1eys38f0K4MI JCzN/NjtYuKRbFlCMbUIVXOufkBydS5g16M/IbDP3+7R3GRfCiqYt3xs9sKdMAp+I6OT UqVatpkSrB4snLFq83qjIWmC9q2I9x9WK+OEdJBzXW6wnZSsneX0dZrpMyLo/Q5FLbWs bgdP9bjYsN+CutQBcsXgpRFEp0h5ZelZElxBY9/orrvd71EDsWtMIxxsZGvY6eHCY1Y9 yG35BDqv+TLmDuD36UmQ2+DsGDWo9/QxJYveZK4sH4EAFMiejJBYKJaC7ohIRByZo1ow JKVA== X-Gm-Message-State: AOAM5323BZL2Os+zuK7mzjnfq7I0C/P3bIYCYpxzQvtPMiSuU06UqIxH zcOZStmi2rtGf5ICUVQ6T78= X-Google-Smtp-Source: ABdhPJwTqlQn72UD9sgpeCkteS7hDk9dKCuzOFkK714XdDCM/8xs0ffjB/PFVSDv0jcFQ3FN4uOZUQ== X-Received: by 2002:a7b:c153:: with SMTP id z19mr3080763wmi.5.1618490704484; Thu, 15 Apr 2021 05:45:04 -0700 (PDT) Received: from localhost.localdomain ([185.69.144.21]) by smtp.gmail.com with ESMTPSA id o62sm8670551wmo.3.2021.04.15.05.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 05:45:04 -0700 (PDT) From: Pavel Begunkov To: Jens Axboe , io-uring@vger.kernel.org Subject: [RFC] io_uring: submit even with overflow backlog Date: Thu, 15 Apr 2021 13:40:50 +0100 Message-Id: <0933f5027f3b7b7eea8a7ece353db9c516816b1b.1618489868.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Not submitting when have requests in overflow backlog looks artificial, and limits users for no clear purpose, especially since requests with resources are now not locked into it but it consists for a small memory area. Remove the restriction. Signed-off-by: Pavel Begunkov --- Mainly for discussion. It breaks several tests, and so in theory userspace, but can't think this restriction not being just a nuisance to the userspace. IMHO much more convenient to allow it, userspace can take care of it itself if needed, but for those who don't care and use rings in parallel (e.g. different threads for submission and completion), it will be hell of a synchronisation. fs/io_uring.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 357993e3e0d2..21026653e1c1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6673,12 +6673,6 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) { int submitted = 0; - /* if we have a backlog and couldn't flush it all, return BUSY */ - if (test_bit(0, &ctx->sq_check_overflow)) { - if (!__io_cqring_overflow_flush(ctx, false)) - return -EBUSY; - } - /* make sure SQ entry isn't read before tail */ nr = min3(nr, ctx->sq_entries, io_sqring_entries(ctx)); -- 2.24.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D027C433ED for ; Fri, 16 Apr 2021 23:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5776F610F7 for ; Fri, 16 Apr 2021 23:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbhDPXdW (ORCPT ); Fri, 16 Apr 2021 19:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbhDPXdV (ORCPT ); Fri, 16 Apr 2021 19:33:21 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7872FC061574 for ; Fri, 16 Apr 2021 16:32:56 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id j5so27191637wrn.4 for ; Fri, 16 Apr 2021 16:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=zdRYFq4rsuafd51uHL/pkV2l1d3Dkd8AfzBXYVGQuk8=; b=oILmeX723AEjsJ41MRd7pd7CD6j2F+MaLAUs1IyLjt7asTSKphmR9vt3s1cKaXfxlo F1plGiauhdr9KND+n94cIuEbMAm3oo6EqgeiAX6yA3yYmKApb9yy+IATysL22w7U21lz hjeErB9KPmnFgRxjdZ+UEEgkl512GGKv3NtwGOE8cX4VyeYQwRYDSy7hy2KyWluFoDzk +S06rHoudENekDbI0CfhAfIAMOap4ca+M/3nZIv5JzNuws09aiSRD/SXyzc2qLsdoCQU AE0Xiv6B4zUJNvJ29pCsagm49BazONazlhlNbdJkoJJ2uTKiEdJq6KanJaDV7VV5S1SL I5dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=zdRYFq4rsuafd51uHL/pkV2l1d3Dkd8AfzBXYVGQuk8=; b=Gd2sICPjj0PWgRrunFsx8nny8zecw6KDB58BVfY9XGQ4m6klQScz4xETbsZk7JOcsM l/gtJniXur8wspyZnsN3IO2ct49e1cj81ZNFdXSv3wlQ6SrwpJsGG3Skqtciq6MhwtWi QjvYZ5EBeAM1X6ay4SeGTS8HPt0tGAu/pYfg6auAdwQKehfw/oiKy8c+XKHjlmV51DtP SSJJt/sUikUzSgqWoT1HWjNOSGPHyhjXERNqNcOKgQrHWjW6YTqRVLtXZkia92qPyVte y6KWBvUC3tGY2Hv7+Y+08Ep3SaSHVBK9E1tLG9TUcSrQqFYdzeDgsL2HipxbdDjHIUgr RGXg== X-Gm-Message-State: AOAM532DllRa3EBA7ID4AeIboW2Uqk07rqXszSPKWzAjL/f0AKkG98qz Kr4yZEfjWmkdQL/TCULkL3kgX8jt3lseAg== X-Google-Smtp-Source: ABdhPJzsbETJYgdealTt3P7D2xh9vlZXpxcVUetgdiU7o+58CWXdkzDRY0CFluI9oL9xuGlWmNYZ5Q== X-Received: by 2002:a5d:55cd:: with SMTP id i13mr1465697wrw.393.1618615975292; Fri, 16 Apr 2021 16:32:55 -0700 (PDT) Received: from localhost.localdomain ([148.252.132.77]) by smtp.gmail.com with ESMTPSA id 91sm11942827wrl.20.2021.04.16.16.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 16:32:54 -0700 (PDT) From: Pavel Begunkov To: Jens Axboe , io-uring@vger.kernel.org Subject: [PATCH] io_uring: don't fail submit with overflow backlog Date: Sat, 17 Apr 2021 00:28:37 +0100 Message-ID: <0933f5027f3b7b7eea8a7ece353db9c516816b1b.1618489868.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Message-ID: <20210416232837.EpkCt1h-_Fk1PTRiQA92ifC9l5pNLc2vk84GqYJcJJc@z> Don't fail submission attempts if there are CQEs in the overflow backlog, but give away the decision making to the userspace. It might be very inconvenient to the userspace, especially if submission and completion are done by different threads. We can remove it because of recent changes, where requests are now not locked by the backlog, backlog entries are allocated separately, so they take less space and cgroup accounted. Signed-off-by: Pavel Begunkov --- since RFC: commit message rewording fs/io_uring.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 357993e3e0d2..21026653e1c1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6673,12 +6673,6 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) { int submitted = 0; - /* if we have a backlog and couldn't flush it all, return BUSY */ - if (test_bit(0, &ctx->sq_check_overflow)) { - if (!__io_cqring_overflow_flush(ctx, false)) - return -EBUSY; - } - /* make sure SQ entry isn't read before tail */ nr = min3(nr, ctx->sq_entries, io_sqring_entries(ctx)); -- 2.24.0