Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp273693lqr; Wed, 5 Jun 2024 05:56:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2dMVAJy48MdLQvTTuKu2zHDzBIrdTSDTy9yW5vJH7A4AXwWKnseAHW/k0FoDVQCK2bq12UIMU6ieM27F0nvZHZynmt2GmE2TKvYh7Vw== X-Google-Smtp-Source: AGHT+IFSYyJHX9upKnvrpPRe3NP7HSCyiTtlOkYIjH69zPug7TWhb8G0Q8iytOFm4b1DKw+K2vnF X-Received: by 2002:a17:902:dac1:b0:1f6:6a85:7ab3 with SMTP id d9443c01a7336-1f6a5a874acmr28934585ad.66.1717592211049; Wed, 05 Jun 2024 05:56:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592211; cv=pass; d=google.com; s=arc-20160816; b=oDOzpJ4m6Fu9IrSQWS9v54WrQIhetb3H6HF/lBp6CbW33Le64Olzmm4gAKxtEDPvNk gtVn8MnyXIg1mhImlphIZ9hpPWyE8SsQgW8yTuco63y8WzqLV7+XVZmSfQMSOLBZ0kQk +VHXyZEl6WRXS8EzUf8mi5ugqDeWvN9jZ6ZPoSMx7bvcQINkqoorIjyPbK0dICrQia7+ XdWYyLUWfczP7CuKAy3t+zObXVnRR76jEKB/wDuEWAL4GiEGKyIAd2Tm/voPLOtfWKJH FfnnVz+H337HYG2LKGjqugzMHFvx7hNHylpGz2hiJwBeMUucaLw2XDQGsYpvT0iFplbB hvUw== 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=NqyJJh+uVQL7R2F4UTvtUmKar+6fcvrZ02spRxy1oYI=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=NLSTMVFOtEPkDETuJZ6SxLEdV9FwFKE/Tp2mNZRUzvWwHTRiMedI3qe684pkZ6t4u2 Q2DF5WREfUaG4LdMbGoNgAsZJMlChF4gkOlyOiqjjTTGSqPdMqaYlTFOR4JX4Q31hgE+ DCOWCJceAwmtiCCzDi7WtQLy4ZS7Q91iw3d89FHiI3czaT0Qwbipe6WJWW/170XxPfHf uge/poR5+QcK7V8Bxq7CwMK7IDenNj1IOuKIc0B9TUmGuvINq8YrCEdv0wC+Sjn//hO+ 2du2GsJIpjKWGv+3FWn3Jlei52SSIs7hBx3YygnVfDJm3IjVPPyheGuoRIw3d5CA1a/W OE4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kJ+BX1TL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f63233d2cbsi2010995ad.76.2024.06.05.05.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:56:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kJ+BX1TL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202476-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1160EB25407 for ; Wed, 5 Jun 2024 12:34:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF4B41C2249; Wed, 5 Jun 2024 12:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kJ+BX1TL" 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 0C8571C2240; Wed, 5 Jun 2024 12:03:22 +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=1717589002; cv=none; b=r2Stwn/+QRctb0VrNqFBRnhViuWrPCEqMmD2L4NqtCdhh3u3ObNJt0fgbxWXTe9UzDPy6v6Uknu2NVW9RgG+aPhcYBEfCpQhi8OboA+EClQW0fVNgLeYJRWnJGlbERo+hMssgKCLEmNt84P56r20vuaGhyPd8vKns5KYBDLM+FE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589002; c=relaxed/simple; bh=vp7txUi8D2St2iqv2V5exkdfuTRTiuxEQ5umbddoIao=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Zxfu8pyGHmwORKJjF7IszYAFlWt0r+daiRxlQx0pO0rdmCSxDeO+YJWEtWSiyNgY85z3mzp/0pdsD0D1WJiaXlqfyRT0m/uhDP4klvXU6YAdAWPKTcqLEScs1RLOa5o9eNcOB6SRD+NvNlYJLnrjL+DqkAxrAABNrnDHC+SfwxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kJ+BX1TL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01387C32781; Wed, 5 Jun 2024 12:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589001; bh=vp7txUi8D2St2iqv2V5exkdfuTRTiuxEQ5umbddoIao=; h=From:To:Cc:Subject:Date:From; b=kJ+BX1TLZ/LCkV87oxxoZjz0VCBhepmeIjsRu4FNIhtCCXuL6L0MNdejBjVS4Juuy lbTV8sLjIn53FxfE0Nc047mPSv4wPQXmW7EuMnEUZ5B3luGTeNKfKPgb0ZajbEzriO xAiBp89/urhT/kIROtvFoPy3OMunhYd4s2c9ca+Yn76C7Uz4dExXUlZO/wobpCAxBY aRw9E+ktBvMzq/siwycfu/7EV0vDHCDatmZKSfgXQG3Q2VY947xuIiZH1b/wV5v8mR 19AMRYaf86gsuocv15A2ztRbz2mZB+9lSnYRSOXyHdPiMNt97XoBuNDnFWkKM10yk8 aQH0b0p4vKt0A== 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.8 01/18] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:02:51 -0400 Message-ID: <20240605120319.2966627-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.8.12 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 75386d3e0f981..615fbdc09d1cc 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -594,7 +594,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