Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1159320ybf; Fri, 28 Feb 2020 15:39:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyEDyDtk5Z/j5kDeFdGIj03wtMxibNZcVCQhnJdKp3iLIaSrqHVSKNerpVi4rdJp8Vo/zPW X-Received: by 2002:a9d:6ad1:: with SMTP id m17mr5497843otq.198.1582933143853; Fri, 28 Feb 2020 15:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582933143; cv=none; d=google.com; s=arc-20160816; b=yakvzQRE+pzmqN1E7aP0zsxx/IrXw/LTZMhdJF0u+oNv26YCK36yVv9jy0NKgKkgWQ gqDBefmh1BbRvPJnLFFA99ZIFuG8jt7Zy/z+4FXvuZm+fGA6N7TMV25/vcktG+NLeLNZ y/qVs7zBjhlBwuLmScBpIYdtJfUz+SEPB80cLyy9+iNx1Ut/axRLbNX0VfieicGFhvqc IvUvvyvQMH5d7AjUVi4mf5DdYdBszBR7q9lcEaBNM6ifWlf6DqETaRn8e2BP0tbXe+ur EtA8EduaQ1ywwXelKVgot+ACjJKlM0N1fKEjIeBaX02wScOAqzSTbC1J9vAcvMD3JS2+ 1o6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+Glx8OEy4WN7rEwyGGSI/EOqZCDmmoWs4N7V708Yku8=; b=IIKhcSBZLyqbN6PyjEuOmDro1TK5tMYSzhUed7EK1f9lJuS11EeoV3UZVDIcTHuFDQ 9N2yV9atHayD6QcAdQV5dCyJKytgnNsrb6RYpZQ3rrK9tfPYcTQ7ookYecgRSXMetS1q igF2OPx5VOukX7EMyWDp9l3jsjVCcVNaN2bh01Jrqzv/NmFtcwMSY41BV8fwSMbX1vtD 5fpxYEvAJ+TiCG0iozAZ3JiOfTNHb9govQqiYd+wwUOq5rb+QbPJ7+MNXU3f+jlcI0JG HpDgzoCd2WdcivDNeT65URqtBq1vifoOua8Rcdy7uxou6hTvghzqmrKRskjIc0hreipi ve7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=alEksy9K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c67si2512596oib.276.2020.02.28.15.38.52; Fri, 28 Feb 2020 15:39:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=alEksy9K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbgB1Xil (ORCPT + 99 others); Fri, 28 Feb 2020 18:38:41 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40191 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbgB1Xii (ORCPT ); Fri, 28 Feb 2020 18:38:38 -0500 Received: by mail-wr1-f65.google.com with SMTP id r17so5063242wrj.7; Fri, 28 Feb 2020 15:38:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+Glx8OEy4WN7rEwyGGSI/EOqZCDmmoWs4N7V708Yku8=; b=alEksy9KLC4+bvVBJPx/uf7o9pA0YjfFQP/uwTuzvIof7YR6PpiaHtG3F9kYYRUih6 MRc7Am/ijV8cqfjjLpN3CigZNltCHe1SBT13XjJ9SV3MRWuVig4wIpMgyq62KugkRSU2 kbbR9Kd+jxODuxFjcvkKM48pAJkf4Wmp+yo1So09eQLPs5hp4V8jOrJzMuO2rpeVA6bn TkQgQE6Ms68kbXcJUHnguGQHNEEIRM4awGoHmluAgjn+7aAJkEb2pDx7o/YSED9APa2t S6esP7A78LnG43n/fNPmRxOgP6aBH50tIt/Z5fN0eS+0U4ul5jDHUygAvIRUYJ5qQAJx 2TWg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Glx8OEy4WN7rEwyGGSI/EOqZCDmmoWs4N7V708Yku8=; b=HcdmRnCUsEt30QiY/+VIHSd90gN5XjAKNM9vAH1CI+Rj+7ib88lWtrjLaNmA13Hw6e MOlIerIKQo9eO8/Hyl3uWkubmgMPPbRbFAnLm/6E7jNLoc7RFTs5yw0b3/s1t0v4I+41 WD/cwQ0fQGnwJIm0uXK78nR5U8FrNm90+GhuJ50PCpFBiHFuAzG5NoKorKJjUJi//mju eMOvDCu5N6/ZymmrflPlpQ0bZm2UCZcgzjN2wC35fa9J2nKwGdvpFERsS3f7YzT7pZrD F9afR3HeRalAv6O/GzD3yEbn0Rr0VRl8tY8l9TNrT5pESusZJDoDrRN2++SbjJe60cng pI8w== X-Gm-Message-State: APjAAAU6IcWkt/J1zls19q891FuVZSOdxLSe9a92Wto2pnF9saePFS0a p7U6wMqBcKwhjIGebo82kKwRsZKa X-Received: by 2002:adf:ed42:: with SMTP id u2mr6990818wro.345.1582933116810; Fri, 28 Feb 2020 15:38:36 -0800 (PST) Received: from localhost.localdomain ([109.126.130.242]) by smtp.gmail.com with ESMTPSA id q1sm13762512wrw.5.2020.02.28.15.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 15:38:36 -0800 (PST) From: Pavel Begunkov To: Jens Axboe , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] io_uring: remove extra nxt check after punt Date: Sat, 29 Feb 2020 02:37:28 +0300 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After __io_queue_sqe() ended up in io_queue_async_work(), it's already known that there is no @nxt req, so skip the check and return from the function. Also, @nxt initialisation now can be done just before io_put_req_find_next(), as there is no jumping until it's checked. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 5a579f686f9e..cefbae582b5f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4857,7 +4857,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req) static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_kiocb *linked_timeout; - struct io_kiocb *nxt = NULL; + struct io_kiocb *nxt; const struct cred *old_creds = NULL; int ret; @@ -4884,7 +4884,7 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) if (io_arm_poll_handler(req)) { if (linked_timeout) io_queue_linked_timeout(linked_timeout); - goto done_req; + goto exit; } punt: if (io_op_defs[req->opcode].file_table) { @@ -4898,10 +4898,11 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) * submit reference when the iocb is actually submitted. */ io_queue_async_work(req); - goto done_req; + goto exit; } err: + nxt = NULL; /* drop submission reference */ io_put_req_find_next(req, &nxt); @@ -4918,15 +4919,14 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) req_set_fail_links(req); io_put_req(req); } -done_req: if (nxt) { req = nxt; - nxt = NULL; if (req->flags & REQ_F_FORCE_ASYNC) goto punt; goto again; } +exit: if (old_creds) revert_creds(old_creds); } -- 2.24.0