Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp265202lqr; Wed, 5 Jun 2024 05:39:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpR4saYwzyjqmcJ6kcM6FV/mbwOo7jrlECUXxO8o18cXk6g8hOD8zdi8PB3ejyk5OeVcV/RiI+32H60DyV/FQYIX7NIKh8cD6iErL1Rw== X-Google-Smtp-Source: AGHT+IGJ48N6lYtdaJn7Xu9GSsPmFPa/k69Vq6fXMQkOt3BKPRIvBxrnpmcmQMCzhP7vHxwbFO2R X-Received: by 2002:a9d:4e82:0:b0:6f9:37d3:a3f0 with SMTP id 46e09a7af769-6f9434632afmr2519577a34.21.1717591187674; Wed, 05 Jun 2024 05:39:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591187; cv=pass; d=google.com; s=arc-20160816; b=ugNMC/tV+7PzqZzpDKLYsX4IbwnirFlVLfaQhveFNajjdo8mIJSQIU4sW/JTtszThJ ayyef+d19z07843SbV4vfUFA9eQG1Xwk1VKA1QiYm0IkpUez56UoZI6SK4MvDWZyROCy hVcSD5ikN6d6PPTNIc7Tr4eAOwWFj+XnmC8y7+5xUkhnJtD6bGZDIobkcEplPeyaFWui CaOXeerrvu5nwrBFHiuDRVxjiILqqWqxzuIYDIZLeKVLGR5hcqaVWmwhIsNdPJJ4dLFL xnF7KjH+V4vgprpAkdIW/gQpFvnbjfM97NBdjiySdJqWvs966I63a4kFaGhKwtR6SSiM 9dag== 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=8ryfvCzjelb3rVxbDSSVUHn2CqhU79y3zlk7X1Fl2l0=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=jMy3Wr7pjnheMjP3w7FOh/fXQ77RPx86HF6WzkW+7KFSUdr0/uJfsmnYT4wWnySJjJ TTJYkf7LqqJYzXqMBIXLhwoH9it2jZTlOWldee+DumRWIy90u7ug5FS5jRkNsWSA+GK6 Kb0qkOaeTpZG7zrsznBX2oDtEk2kUuT6VBvnYFn5+Zs+G725213dn8Apij5nv7MPJygJ xvsyBrvqocnywLh5I0U2cEZYdG9L56eab17l94NW9T8LhinSZjhp76+9l4nBn5YM/XDM 11AWy+xXHr0ucufZF1J0v0Sk/Nh4d+uvOCiVuQvrYoy2XOb+GFUIMqm0/o7uXSm68aS1 kCAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="LksSl/7s"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202495-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f32a5301si509812085a.555.2024.06.05.05.39.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:39:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202495-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="LksSl/7s"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202495-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202495-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 65BE61C23329 for ; Wed, 5 Jun 2024 12:39:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A2BC1C6193; Wed, 5 Jun 2024 12:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LksSl/7s" 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 6FAA41C618C; Wed, 5 Jun 2024 12:04:11 +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=1717589051; cv=none; b=AdU8LyjkixmeUhLI/YYle0rQqfivcDbxG+eZ18TyR9oR9X1Gyfv8olfKZWA6P7f6BiOuhoSjplU5tQmworRENiMc1JC52Jpno7F1aRoIZKZhwOU5Hw0iGNlNjnFtyfpd0u/9qcjpRf2opuEhrFri97UeQttXbELjEQ8QYM9OtMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589051; c=relaxed/simple; bh=lsSnOw/I7PMfIGzl4KME7Z/oNsBryNMwUMCncRfe738=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=o6F4uuJVUkAr6Ko2Qlk74AeiRPsVXEJcFZSrUrJhxAIseS0pNR8U8GXdkxG7wehOqLt0oSQWzK31qMvplp0OYqWRca3Q7ubnYlfYuL7tqgbqOM2bGoXPsGJ59c1G9f0rAlKQP7unX8hdz57Fedh4lxtpIfbSEkeYicATSRyX/mU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LksSl/7s; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27BB0C3277B; Wed, 5 Jun 2024 12:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589051; bh=lsSnOw/I7PMfIGzl4KME7Z/oNsBryNMwUMCncRfe738=; h=From:To:Cc:Subject:Date:From; b=LksSl/7shuJUqm8jngnyi56asL30++7+Fh5WDIztbsg7ABt4fOMDGiwSn0//Haw/d 39joLO9L4H3Pr7kai/VkCJCajkGcTIaq9BkgOSPz6w3PWTqGyGTzMNKiLY8HbFpENU Oph3vc6xRXFBIjboZyDi9MPKz+NFd29++EtpnDS6kuxNEkSVyQ7fXMHvRncZJQr7BU Y7csAdgIkfvpeKBwHh1KQaBNewXvlltBnLyrgv918IY/a/hO958FMkxTz/1wzczOh9 nEJ9IAta+veum773UPfu3CGD23Desw3W6eA2PvB3bG4ki7dIpMjxwE4XyFScj62uEG F+w6sOk3E8nwQ== 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 6.6 01/18] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:03:40 -0400 Message-ID: <20240605120409.2967044-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 6.6.32 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 0a88d7bdc5e37..6a444ce273366 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -592,7 +592,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