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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 30CF1C4332D for ; Wed, 30 Dec 2020 13:08:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00290207B2 for ; Wed, 30 Dec 2020 13:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727284AbgL3NIL (ORCPT ); Wed, 30 Dec 2020 08:08:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:54520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbgL3NFU (ORCPT ); Wed, 30 Dec 2020 08:05:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C892A224D4; Wed, 30 Dec 2020 13:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609333429; bh=mk8PmzHz1goX0mwz67HLEPYdnwCimSAxUXWHQi5z6lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VTCgamtr/6+S6qYx4UBZazWVI0DYkz8nNm8coRUbzkKz6VJNwMlBo/Xyc53PGtSpq a9unnZVBG4ZO0B4mr052vg2rR+GyYHhrF3l3KsLcKKzwiBuCwzSmDoAIaEz6DN6v/K xnve1JKO3eJqKH1JynHgzN5btndY1lecfZovakJe5UHb0QVzVfVZ0htynrIlSEqH8y yoVOP/OJIWJk1cB18Zou8KI6beSbbRwyyN0RUo7PTuTU9yFNLelnFYSVh8jKEhMXgc kv0iYhoLP/1VITjlnZUXvEjxy/TQ6cbBzMBdHzUtHf4JCjWyNjyJhmsqQomSVbF64j 9pakI8k85EX6Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pavel Begunkov , Jens Axboe , Sasha Levin , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 26/31] io_uring: remove racy overflow list fast checks Date: Wed, 30 Dec 2020 08:03:08 -0500 Message-Id: <20201230130314.3636961-26-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201230130314.3636961-1-sashal@kernel.org> References: <20201230130314.3636961-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Pavel Begunkov [ Upstream commit 9cd2be519d05ee78876d55e8e902b7125f78b74f ] list_empty_careful() is not racy only if some conditions are met, i.e. no re-adds after del_init. io_cqring_overflow_flush() does list_move(), so it's actually racy. Remove those checks, we have ->cq_check_overflow for the fast path. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/io_uring.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 86dac2b2e2763..4b3dbe588d111 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1632,8 +1632,6 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force, LIST_HEAD(list); if (!force) { - if (list_empty_careful(&ctx->cq_overflow_list)) - return true; if ((ctx->cached_cq_tail - READ_ONCE(rings->cq.head) == rings->cq_ring_entries)) return false; @@ -6548,8 +6546,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) /* if we have a backlog and couldn't flush it all, return BUSY */ if (test_bit(0, &ctx->sq_check_overflow)) { - if (!list_empty(&ctx->cq_overflow_list) && - !io_cqring_overflow_flush(ctx, false, NULL, NULL)) + if (!io_cqring_overflow_flush(ctx, false, NULL, NULL)) return -EBUSY; } -- 2.27.0