Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2623131lqp; Mon, 25 Mar 2024 04:55:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUiLcS97EDb3C9jTj/VWBXQfY3CM38ESebNr4N0hNDfRxEYhxB66+vhldw2QQVZowipeVpESj/d1SeNcuWMdp+9FmXxHTVkclsG7G30OQ== X-Google-Smtp-Source: AGHT+IE80Ag8GlXsuUExqVNxqCXpv3IRAbkJomV85C4F4rW8YSuTIk02+1HF6lbcwk7EP4JfKQYo X-Received: by 2002:a17:90a:6343:b0:29f:66e2:d2a6 with SMTP id v3-20020a17090a634300b0029f66e2d2a6mr4723509pjs.26.1711367711176; Mon, 25 Mar 2024 04:55:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367711; cv=pass; d=google.com; s=arc-20160816; b=TbXMnMas1qXRU/a2hNrCp4k6NqH8DMk8T9knfA9Tv56TfQsUz9NUlBjdPDAlBMpEk8 wNPSv+KZvnjBocxuGDqziS1RBojW6h90UY6zyCdqzQEW4MOQhRVya84bGynbUPdTYqh6 DKj31RekROjb9boMSYWfBUF2fgZZ2MOfJ6vpIHZjYkzeFoEYU+nwuA7HNN8WdhjtSXhz CNUSKK9oc3+YvUn5ncFF+0StF3n2sZMS+hGc8YH5Y4/B5peRpv70HB/KxcNzjgbJtxEO f2ZwrQYuQEYW07A0ZGtJx0q/+tzfxzq7yErvfX6qKo9ItynPadJwfohQwfKyOCqCZ2AH O9Dg== 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=bMHes7XXz72bZ1+K293Q019/8w2bvjuUnOrSczBdgpg=; fh=wL1wqGC3DgM6mI6n9WBAc1C0Sm5Hok8BeZgzc4qHaIY=; b=XUDbiaAGigVvU2oAiX/GydIBhT1985iwtQXqCNe8/bR4TLQ8/7Joq8ycXunzWLDgNv GoHOxv00xCLvRz7HJZQteL8S1Dg582r7Zmoy6+JcfCEC19KJGBLpVcPfTASdAKDUcG+2 PtmpfO6KH3P43KM4RN8kgarFBLiGPJgVvb3VeC6D69Kx0DTSyyUY9WPbweMROq6RPCXW jq4HSAbeakpfCvTFCQZcHTOyqgira9S4mk1PC2TWYnPibLAdfn9gZzL3jRMLPqRGyrym aYHQnUR3hez21kYDXoFhNIEwNPawa4AKrHLLBCD+lrCXRrL2lMqjXEoOSnOrDj0xK1gH 4ZwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tmgQ1KsC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116213-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. [139.178.88.99]) by mx.google.com with ESMTPS id p8-20020a17090b010800b002a02bd053f4si7451792pjz.180.2024.03.25.04.55.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tmgQ1KsC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116213-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116213-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 1A7A02C391B for ; Mon, 25 Mar 2024 11:47:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD29E13C900; Mon, 25 Mar 2024 03:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tmgQ1KsC" 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 58DD217DC06; Sun, 24 Mar 2024 23:44:00 +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=1711323840; cv=none; b=iMjeQTyX8Ta6ZuCqfhS+ZPbiOqgdHuvNaYPl3ftZL1xV7H7sWmKmahmqpqAi2nPgPAwtSU8XZhozYGTbNfiQY/b7bVwFadCpVd6XuSu6pA5SN6w8jNlJBdCOdPWbznOL+XsMLF7mOnXvnKV3Hvur6+3ynERp7wbY13bEzOHJ3ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323840; c=relaxed/simple; bh=c8yoc+gw3+doOP2QyCyd0FANFcQliti7oGbe3TbzbFc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cYSWpaPglIwV4MCdbLswnxaeGcxP3PsPEmdcVEbg+3HdGIG6q4JjFtpmz8PAVWMYRd4kPkwNKarZMzZMbzmAPbTp7tWfVybF6arRDx8qqnN2Tvrn8XOFoN2FqFOtK5W80Dzd1ZSFnHJi7x92PCjQX9982QU0NxPM1Fq7Od3eCqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tmgQ1KsC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FEF2C433C7; Sun, 24 Mar 2024 23:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323840; bh=c8yoc+gw3+doOP2QyCyd0FANFcQliti7oGbe3TbzbFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmgQ1KsCWAvDOfqfttSmMTj8c6PUJj5SeNYT1WIRsf9yKJjxZTfI31diPrdiJY13n 4qmZqU3w9lxKO6pLf8VCic+onFdL9b6BELumvN9dHzyBLqxc72Um5E0FTSCl+pIhyd cCJCd0LWLeMsFUqDZ1z8vgFVgefUwHVANpMiNlbpKytTWV9u9jbd9BA1YAl/RGAM9M pp4g5Uro7fttCvqRwtEoJfZav3yhIe3c2Z0F1lTHOeJyayh+AvHD9OViLx05fkyIfa MMCJuFwMdBxqfx04FiwdxYoM5luJDcc8JfpJ36/AYm3//q7RwOaUpAD0d/x28FtlCB nYGpCNV9yGTCA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jens Axboe , Sasha Levin Subject: [PATCH 5.10 218/238] io_uring: don't save/restore iowait state Date: Sun, 24 Mar 2024 19:40:06 -0400 Message-ID: <20240324234027.1354210-219-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 67a355f27ad80..fc60396c90396 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -7640,7 +7640,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, struct io_wait_queue *iowq, ktime_t *timeout) { - int io_wait, ret; + int ret; /* make sure we run task_work before checking for signals */ ret = io_run_task_work_sig(); @@ -7655,13 +7655,12 @@ 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 = 1; if (!schedule_hrtimeout(timeout, HRTIMER_MODE_ABS)) ret = -ETIME; - current->in_iowait = io_wait; + current->in_iowait = 0; return ret; } -- 2.43.0