Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp277048lqr; Wed, 5 Jun 2024 06:02:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGnFVclMj2ocOasegaq2yK0NpM38amPMNikPZYCFypdSpd9DEteuGl2oCIgLQcFPqd5Vjt2Ej0UVyVrpCXgqzB0fNtIWqpcIzaw+PtZQ== X-Google-Smtp-Source: AGHT+IHBFG6yGOSjyokOjxEPsMf878ki1zvD+E6VqY4/MKqx/WyOVvKWxD4eGGQBq2WgvBiQaRib X-Received: by 2002:a17:903:182:b0:1f6:628a:1971 with SMTP id d9443c01a7336-1f6a5a80de1mr30322495ad.57.1717592536575; Wed, 05 Jun 2024 06:02:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592536; cv=pass; d=google.com; s=arc-20160816; b=OBzslj1YDiuI/QSzDI8PLZ7Pn+VzzOF6VVBSigAPKvbuCPTRM35SNut7b7oSt4Quag IBK3r0PoXfmnu2Of5RSNJhNT8GW/8EbEeJIemAKwg1lq2l3CVlJQl8JqsNeUBhlSz1He AkeDxkcL2p3d1r3JkVeDLLQliYDw1ZozM2OWCV+rW6YKaxJHwgnAab4R/fGvZ7mytfbt waaGk4zSLu5b9sHnZe57hffcW6DDe0LxayDN36m9w3YC4iCOobT/q/2NOvXXeSgr82lt UDxoDSRPZyk5NNYoPS0fn9N4yRVeblESQhq+8Zsd4gnlaUuyfFnPmlKaSljEAkXu+dHO JG2g== 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=AjHCSCrrFj6jkDDN2Ay1P8HQ19//2OXcelFooXLB7Sg=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=HtsgwJuefGfhuB4myUhlo4ACfKGJTr6dDFeXsmFDCaqlXmj8mLt9GmPpywdp/y3nyf CrFfOL3IXxHT3s75lUi70SjwWYkYIwotlab8xAQQAV2iOdQGgBaWC6YnXBLwa1BdIsar M5d5KSQlBRjw7wR18cTNuu7PGcR2ASrzxDkapg9QDs+1z2HJ4Yp7mCNgQGYXfOMYNuIV BPjIf2YN7BuTdJErgOsdjujtkVkMVhSr+zABYPrY8+3LLgDmyb3vImbEWSYMbXnt5S5h ZLZ6MqwOA1+YmERVT1UkDDzGGI9y0O7STh6tYyAq0b5+SnDw0c9syEL5Qpwm4UJkVKg1 K6Dw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JszvcpbW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202541-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f63233d24bsi103436935ad.90.2024.06.05.06.02.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JszvcpbW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202541-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 76FED28123E for ; Wed, 5 Jun 2024 12:52:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFCBF1AC246; Wed, 5 Jun 2024 12:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JszvcpbW" 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 027971AC238; Wed, 5 Jun 2024 12:05:56 +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=1717589157; cv=none; b=RDuM+E/HBV2Gg2WMmUf3ngIq6jzwxMyZUxqF2XqQPXqDHTLtDpSXOf0smP1eA+lg2y9u+s5dQJxfuB2evhPnkcM6eWxHgRCE+1jUYIFh5EOCwzSls47puTtE7eR9Siyx0kLsXKs2hAOAMyUmF85kjQoc4xnVVlaM2ViBRH9h/4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589157; c=relaxed/simple; bh=nVJRpRaHgI+nkFlBEpSJxAeDE8zbvLSqEEqAymsMMJ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FHayZfy3eSRz6nFb9MQz3FlYdxCazO3R8SVJovx0CLiCH9ohC1pAyoTrsCIy7Y4IM/BBQtxzd89dNkCdqqGoroBc8VfR9lmFsEkOWhDiQVgq8m6QD3KTxTE9T/6IJxnjbzhoUz6a5678hv0jf5/Y1YjEPgxMD3drX70DgyEXgSA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JszvcpbW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A416BC3277B; Wed, 5 Jun 2024 12:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589156; bh=nVJRpRaHgI+nkFlBEpSJxAeDE8zbvLSqEEqAymsMMJ0=; h=From:To:Cc:Subject:Date:From; b=JszvcpbW45EYPcXuA8boXylLE9f5o38xvpBQPtqyqAXLLRjaUazyLEj2uQWPTv6Bu R4ZRruuTlz0THdOjDb2HWp68ho5mReMFXEv7Ec3XVFcfDYwS0aYxxi7SbDatGz4LKl wDyRKwEbg6kOWJU1dDr5clTPn76mk4dn8ssXppzyao3IYgHWa2ckb8Q54xs7rjj+oi nk0izIh9dEQrxn7orgHpiKX1C9YnsrwL3uGVOrM3o7+xqZsHDuWYesWdf8XYzq6ESU FXbfAn3xw3oFFa7VARXwC6L4I0zjFmdmLvDC15Moo1uS0iIDJ2+TUoTVnyas5MBJJS 3nY77hckZOW3A== 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.10 1/8] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:05:44 -0400 Message-ID: <20240605120554.2968012-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.10.218 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 379d6818a0635..a4e8e7f331235 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -419,7 +419,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