Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp278014lqr; Wed, 5 Jun 2024 06:03:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5RSyWd2Co05Q3I69eN/H6ebGIfh6580wIyOnlOVs9bvQqCUBhudq4P+M+dj7yHXSwDQk4lqMCmxZ0OA40fFflIR3W1uuYKQnFFd21LQ== X-Google-Smtp-Source: AGHT+IFav4BbkQdZ8dzxumEweqQoNbz2jZQLbXxEA0Nfdj2l6q8lA3SB4UMF7ngIULZylc/nh3BT X-Received: by 2002:a17:90a:c08b:b0:2c1:9469:11bd with SMTP id 98e67ed59e1d1-2c27daf74damr2386786a91.3.1717592601309; Wed, 05 Jun 2024 06:03:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592601; cv=pass; d=google.com; s=arc-20160816; b=z1zzEdfwTwlwNKScC64923m66+6Sox22AYQhjl/roa+gSHU0spnIudTMiJcpUPgv/B 40w3hZejlR6SKAd/oqxoynuMHpSy+s5FgHxdT3GVL6omifyLuzkxuvzpOVq4YRGSq66u UHVEBv+ADynCbxT9nGyaIVN21iwD92fD/BQOVFzmhFyhtHkqoNG3uJL/jh4LEV+Y+yZ3 o2QJJ//VCcQAScO4YAzZi3kGei33PkqbDCr/oOBb5DxqK4yfFFJFCgTo2S+PUpak1HGY BhA2hw45qrnB9b4+96LIDCMeVkfbj6/jN9y7xdqn6MGwGsBYiwx+tAggdhGr7yJtLoD5 b6Pw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=ieY3Im2Itnux7Wc0sGnHdlv6SodQIabSwJstEVKqvTY=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=I12ZXPiuOj4J8XW1VSk+s2+5fCxXnLUZxH4RAU1yvhs2W1JZr1dPUHNINOkwEKarae isXrPpcHKfzKw8KycO1NOYInioeexPXmRZoPSmdd2BHdtf+vMDniEfqxiKSz5++OCxmh smFfefsb8DGA8LTyih9jj8q/vu4Qx0FfTmZGJ1Crkj18DXrYMtsuyqaryXkJqKDfwucd TZePcKLkDGslzPoGNGmSwYawNfgOpFYFzAaW8jYkSAUHgJ93t8oUoB/nv1qGFOnT/vPa gf6PWFjxz7ZeD6nX8mhvXTAL5Tts2QrAJi5Y45fZWhdhbHa1roiD6wzNXst0wg1ygQzh JlBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EVctVR+e; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202528-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202528-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 98e67ed59e1d1-2c2825d4537si1151239a91.118.2024.06.05.06.03.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202528-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=EVctVR+e; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202528-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202528-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 318B22859D4 for ; Wed, 5 Jun 2024 12:48:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE9A2188CB6; Wed, 5 Jun 2024 12:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EVctVR+e" 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 DB4A41CDDB7; Wed, 5 Jun 2024 12:05:30 +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=1717589131; cv=none; b=iZytONPbKoxCbUn81LG6M1YKm6vwA5S0lU6JUzau12vqoqnodvfQM1iifVv61M6biAP4qwb9N1rTbptEL70L5p1pr0ykve0/6+q7NOsMVvOxe31MMUJKy4FebJi0OebRJPIPE7ZW19th2E5jyR5Xiq0kFXL+WJ9lALxxeH/nQsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589131; c=relaxed/simple; bh=doepLDQwS2z1/JoKLr3ODUteocCb6CNy0bPgcApiWFQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uaUb67FQ1mXzeHx15juRb73USSZhceVxxgC65LrVMlm+3rwL9gX8RjPQF70ReQ808kdzm+GTpUrdQ3yXPh0P3PvKm0Rn7YDv4c1xG+taOsheQaP6vMu4JtDnPFkuqvbbvpTuM1z0/KWqCFDvC3zcLBeITtmYsqxbVZ/CVTizsnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EVctVR+e; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1498C3277B; Wed, 5 Jun 2024 12:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589130; bh=doepLDQwS2z1/JoKLr3ODUteocCb6CNy0bPgcApiWFQ=; h=From:To:Cc:Subject:Date:From; b=EVctVR+eXCl/5Vmb87Zc2qUXEFdygiJ4tC7atLDM1U3a24whOCME1v28iJMpl5md1 VtNT56BakRl6EXHdokX/igCoZTGdFvvdXg7O5h5MnTQp7Yc2JD7astR+efYPL7adpR CZWeWKualgR7R0Kh5ejjB10hSSkA1O/jLk4Htr/XCjyZJjMIGGoxOlJwKvhiKxnlSV oAMJD0ANg+TsSKKGl5X+XDdHUyVdiBU6kgjHCk6NbqsQCrIxbVVn3X7nEJVOpCvkeB j/OE8AHO5ir7pHIrIp/ugtxYO8v2rM0+13MV1j8K3gYuzb4qXd9W27y/qbsm8+XDJj TMaAgNxv6MHEw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nilay Shroff , Christoph Hellwig , Keith Busch , Sasha Levin , sagi@grimberg.me, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.15 01/12] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:05:11 -0400 Message-ID: <20240605120528.2967750-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 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 X-stable-base: Linux 5.15.160 Content-Transfer-Encoding: 8bit From: Nilay Shroff [ Upstream commit d3a043733f25d743f3aa617c7f82dbcb5ee2211a ] In current native multipath design when a shared namespace is created, we loop through each possible numa-node, calculate the NUMA distance of that node from each nvme controller and then cache the optimal IO path for future reference while sending IO. The issue with this design is that we may refer to the NUMA distance table for an offline node which may not be populated at the time and so we may inadvertently end up finding and caching a non-optimal path for IO. Then latter when the corresponding numa-node becomes online and hence the NUMA distance table entry for that node is created, ideally we should re-calculate the multipath node distance for the newly added node however that doesn't happen unless we rescan/reset the controller. So essentially, we may keep using non-optimal IO path for a node which is made online after namespace is created. This patch helps fix this issue ensuring that when a shared namespace is created, we calculate the multipath node distance for each online numa-node instead of each possible numa-node. Then latter when a node becomes online and we receive any IO on that newly added node, we would calculate the multipath node distance for newly added node but this time NUMA distance table would have been already populated for newly added node. Hence we would be able to correctly calculate the multipath node distance and choose the optimal path for the IO. Signed-off-by: Nilay Shroff Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 73eddb67f0d24..9ddaa599a9cd0 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -516,7 +516,7 @@ static void nvme_mpath_set_live(struct nvme_ns *ns) int node, srcu_idx; srcu_idx = srcu_read_lock(&head->srcu); - for_each_node(node) + for_each_online_node(node) __nvme_find_path(head, node); srcu_read_unlock(&head->srcu, srcu_idx); } -- 2.43.0