Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp283826lqr; Wed, 5 Jun 2024 06:10:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVV9AnXAqjBNVK0+H6d8b+dkY6RIOR9/Jay29cqGp1dz0RONBWHC6bQXRegbqQmWqJimrVxPSVvJpAvL03SdlgSLzzw2IsqmEsFeAChew== X-Google-Smtp-Source: AGHT+IELet6Zlj2xO3j82wtdfjqyNNWPeaf6o06kVg8bPDJZnFVCUCBHrd+plAN+KLpiSSjbdRgO X-Received: by 2002:a05:6a20:f392:b0:1b2:b0a4:53dc with SMTP id adf61e73a8af0-1b2b71c89camr2534357637.60.1717593028820; Wed, 05 Jun 2024 06:10:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717593028; cv=pass; d=google.com; s=arc-20160816; b=mbseet2yhlGotOw/RBMk9EterBjuvu5PF3+pLA+75Kl11tqcL9StL+Blf+OFhHSKu6 2oYPSyoHJwvTyRBVgMe2wcfURi+qfpHotQnT39yG3iZOi4szmbn96C5QN+KzRxaQqxGX XDyIT5GXTyxc6qeZrk70KqxObZ8JzEZxJ4yEiiaNpqRmo786LbWT98Z94UDmFzUeYLqx tQcE5sSn3walcM3jn+Q+f7TZkgi4kMeElQkjhZ8+9G0xztzYgaDN5S7aZYCkkzmKUeOf mZKLE75pgbguA3odoWuLvf+HQ8aVjHeAYqBDJxdmuEwBeNQ/PKdr/kgWbT32YP2FZFnL z/tg== 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=YgS363HXEDKLCbkwMJHeC3e5LAbcyt7jLOkF3AWEVYE=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=vA/gDKkymvhqdi8nKDs56QuIcrAo2F3jZQAdL/XdQzFo98LpXe4iTSrveEf1zDqt22 l8TZKm2FzZZtH8HccNSlQyvJJamnjTl1Ubb26lMK+ymIpqSfNJZV5ZJcxC5QboNOZT2K XWqRXIgbm4A+FgrTQZEIGUEZbX+tUla6AvjaHBptvH7fFOF1cZfyfA2yaxgVFXT5+IMa X4HJQZ33uqJpoEamOhlIe9HyU1lFgXvwcCCUOJhT0sr/uJX7B+BrgvPlA0JsGanHST+8 MZqZ8VO8xXFMZpkhCrlNGEpzL0Ayj36siboDabz/cfnmmeaz+p/uYa/SEdLZlpHR9A0K PuBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P0lCkUmj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202514-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202514-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 d2e1a72fcca58-70242b0a367si2837414b3a.178.2024.06.05.06.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202514-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=P0lCkUmj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202514-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202514-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 CD49328C0A1 for ; Wed, 5 Jun 2024 12:44:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FB68188CA3; Wed, 5 Jun 2024 12:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P0lCkUmj" 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 514A51CAB98; Wed, 5 Jun 2024 12:04:57 +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=1717589097; cv=none; b=egvZ2bWaU5lcU4RGeq3W5GmYB3sisLxsvJRHracbJ8qc80POQulXfkLDb1sVl1ezwhrTp/9JTkUdj7BiPwPQ6c7yzWU8Q9yplsfshSSY13zj//5izH+YD5J4WdNoTATIzc5mv8R4Xglxjd3HU/t538QRjqzsilgChoMQT6qG7l0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589097; c=relaxed/simple; bh=Lmhh63CniRz7dCHgOoa4jJKSV5NqmaSY2UWwpsyRO/A=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Iu7sACbwemOSovHKeE3IvCrM1ccoEAHOivucMGsQRdxujDLVXyKdoz8pzTDiJZv0XyPs3gAB+o99r75QBtcTNLtwJzGzSMZeLLn8OY7fRjlwN6YcUAV6Y5eFAeZTDRETopq/sdxdqRNtYMMEQPi2sgeZ21mtQh0aViBWib6UhRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P0lCkUmj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC0BC3277B; Wed, 5 Jun 2024 12:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589096; bh=Lmhh63CniRz7dCHgOoa4jJKSV5NqmaSY2UWwpsyRO/A=; h=From:To:Cc:Subject:Date:From; b=P0lCkUmjbvMsZkviWDnsFdlkiu9GDL7kb/FDCZEvtcNdunnVq/cWPlAae1GNLt5vY 0BbGaZhZ3XQsyhOjia+BdwmyCKUsyqkj4lnffTRkXJwKnZkiz2d/KzC2vJlYQK+iye GqknQMgW34XbRcMP8W4TsrgG8O+OUHS9A9QMQWHUzFaeN5HZ24Ui+7jT5DG8xu0qeo yBT3IcNhEOldoW1KXRZQEvShrRvyPre/YoSrA/RPR01prTu85dSRZUI1CILuIBLnvB r4wduJKS36W3z9MsK5ha4WiRgLwWYvQo1b8wlpMxNuowUZbHRq6/ouUuRo2QZ2cbfr mfUQHmCaQL82w== 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.1 01/14] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:04:34 -0400 Message-ID: <20240605120455.2967445-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.1.92 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 f96d330d39641..ead42a81cb352 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -558,7 +558,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