Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2401639lqp; Sun, 24 Mar 2024 17:59:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWS2PLI9iuKdRNotsZy9XIE1JxuLIuNB075WLzcFH5eDHyoaeliRSp0Gbea8KNz/kPQg8BeQ9A+ME5tATM02qMUq4H+uSwf1iCvnrYvuQ== X-Google-Smtp-Source: AGHT+IGVn+E44YDHW5LIGdljzHIF8XR0aJT6bkQ8FhC8yKV9qNbLxllgiutDuB1MKpQfPIypbq2k X-Received: by 2002:a05:6a00:1911:b0:6e6:97d1:57ab with SMTP id y17-20020a056a00191100b006e697d157abmr9078434pfi.33.1711328389012; Sun, 24 Mar 2024 17:59:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328389; cv=pass; d=google.com; s=arc-20160816; b=fX902+tmWGWyvUmomyLOlyj5pB+sEKCvh8A4js8Qo0iJIZNLtyGjj1xy5wk1Fi0qkc qV4r30eqtwk2KIWv/gTRuEYAQN9ZaHVAjG457kvEV1nJxvf5G+JWH79WMXfg22QjdFDM AtVbvUSjYfEdXaawr14FWi2Hd6w7yv37favBNhcVBVuhzeJDvKwjq2wayW09w4uRl90g qEnzPqawH/M1doVvYtd68tXQQqVcLFaM5CqYcX8l8uP7exQX6SQDznFHJECnjjiT49iB ZDu1/dzKmyLH3Q0jCtRnhyhY8iLw/4NTvj5bNwuzxASnQ8AnFByPms9ioPmFR/ZHFHwQ JI5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wcNQUv2wk5LhONEQMmilnxAQm6QtZLesojScPaJvBwo=; fh=wL1wqGC3DgM6mI6n9WBAc1C0Sm5Hok8BeZgzc4qHaIY=; b=RvZTTqEm5MOEZzA9GdJCIUYbIp0+nkruM9KsHJrr502EmkkIPdAwW16fN9t5U1v6Wo RF5fTd1Bdbd/ulnBsjX80iDOfVxjbuJ9aR+14CC05KpThgdRYMd+uE/E4VDVubh918G7 PBESVPOmp30sW6D1WoDrqdO214G0qRiQYdtwDKRpY4gxOldUeZYhH17jJ4YENTrpuMZ+ qQeWwICO8iaLnjvg7QzXonlg03gdtagexl/t50YEkoPfrHfh+/BtmmV3IA8WU7vkRKIc VCp9bUFGIvY/piB5tbgwGvO41qzmm6HG5up2AhrT8nSgJFP7X/O16L3Ctmv7e5ih1yvL TYMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ETs9+QE+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020aa7982c000000b006e68194dcb7si4183317pfl.401.2024.03.24.17.59.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:59:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ETs9+QE+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0BFBA2842E5 for ; Mon, 25 Mar 2024 00:57:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E153B1BF53E; Sun, 24 Mar 2024 22:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ETs9+QE+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE0ED1BF51D; Sun, 24 Mar 2024 22:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320332; cv=none; b=SiLax6rxPsR6QsinhhZ7gmz+ZiWeZN8iZptukoZo+MDM17lqcZUL4y3IieMvAXnWWLyRUdxDDk7dTQ+tx4nwLy+8vxlswrCcfarYwe6HcAV8BRWmnRXXkEQt965Dv9MoaXRvNHlyh3q8QGdZrWlfMJoK9NwEY+aXmn+sWzOMLtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320332; c=relaxed/simple; bh=oL9bOEKE6eutJbiJSZAloAwLP9RkgyJ8pIjxmXoq7is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GR+HN0r7mIpahuLomuk34hA7SIi7Pj2NT5qS26HVQ1SOkZRXRVpuiWr4xy7OcZVFilWqItL0rHWc6GGtBH69Z9D4lU9eOouDRqgU78qo7ZoWSSfHSCLNFgQE/xJ/Y6vit1rzZWI+ABVX7vzSU250d16AXvoF6CAefP4JYMR7BSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ETs9+QE+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A8CEC433C7; Sun, 24 Mar 2024 22:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320331; bh=oL9bOEKE6eutJbiJSZAloAwLP9RkgyJ8pIjxmXoq7is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ETs9+QE+fFw2UFXip1KqKAmhOGDEuxqmYnnE3ewa+JFRJkJy7aTwxJUq8gMORpO62 PmwrxF5tsevr8HM4/SHDZSwvj2+JJeBoIdbET6ysCThSAes36RijJ8yGmqhH0KJunU RVIL0FvV/I3CS8+ovU53z1oqUppo9RqTv5t+gkDli9viFFPujOBE6GwgxFj4oZ2X+G A2xYNiyKKt+aM+ize/LZmwlcI4kFRe3wjCE5FiK1bCBLN2n4jXwLqNKHoOdTjtyRU+ sZgExlmD1IwV9WZh5hMQxMnV5hq8tFLwEMi4gsQXqtACr2kKaxF5c6N+A1LE2TU6B3 Ad6levUrjD6og== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jens Axboe , Sasha Levin Subject: [PATCH 6.8 639/715] io_uring: don't save/restore iowait state Date: Sun, 24 Mar 2024 18:33:38 -0400 Message-ID: <20240324223455.1342824-640-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jens Axboe [ Upstream commit 6f0974eccbf78baead1735722c4f1ee3eb9422cd ] This kind of state is per-syscall, and since we're doing the waiting off entering the io_uring_enter(2) syscall, there's no way that iowait can already be set for this case. Simplify it by setting it if we need to, and always clearing it to 0 when done. Fixes: 7b72d661f1f2 ("io_uring: gate iowait schedule on having pending requests") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 39dfb83dc9fc4..030cc930d1c6a 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2527,7 +2527,7 @@ static bool current_pending_io(void) static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, struct io_wait_queue *iowq) { - int io_wait, ret; + int ret; if (unlikely(READ_ONCE(ctx->check_cq))) return 1; @@ -2545,7 +2545,6 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, * can take into account that the task is waiting for IO - turns out * to be important for low QD IO. */ - io_wait = current->in_iowait; if (current_pending_io()) current->in_iowait = 1; ret = 0; @@ -2553,7 +2552,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, schedule(); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) ret = -ETIME; - current->in_iowait = io_wait; + current->in_iowait = 0; return ret; } -- 2.43.0