From mboxrd@z Thu Jan 1 00:00:00 1970 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 9CD8A1474A2 for ; Wed, 18 Dec 2024 16:04:55 +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=1734537895; cv=none; b=YEebYUO7ugbJ1PcYA6lOaa6jqhOqRwP7jtdyykqzwaRjPm8iyOMDZR8OC9uhywRFubNE+VQxAb0EppzNXmtFGisLTRaySDZdQaX/GndlgZMPalH4dfxbEIrVRy0fBoPbKn78KQ2odNsFi2sjKYwQAvVNIePeicdaO6R5AqstYQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734537895; c=relaxed/simple; bh=9Tuq+Dd4vAm3dwiwnu2JbTxvfy0maNdyoXXRi7k6mfw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q9UPWJJDt+orBj+/X+JhDSU92cWhWkW5D2viLLr5lIGwLpNRPa2Jtqj9QztsW7Rp1N9pv5TMO40COv+hxugrqKSpio9hWWVz7crwKg/RJKcsTNE2chX/9KO3efG0L/WCJyhJDq04xF7SH5/djipSEJRS5gMkXnmgVxWlj4lVj5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C36a6LIU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C36a6LIU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0679FC4CECD; Wed, 18 Dec 2024 16:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734537895; bh=9Tuq+Dd4vAm3dwiwnu2JbTxvfy0maNdyoXXRi7k6mfw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C36a6LIU5BFdiyKXJcL1n7m0pdKYQCppNTgVpbYf0Xem2d+3i3pZUdBTGuqKRroNg JJyPWSCd8Q/QBa/8hmAEMgGUrOQbon7ZIr3YyRjDKH45L+wk9pI+cnfFzuOoJxORek bvXar9ErYNzKT+wSjUd16Not9A2xw1R/wS3ckbjqtTn4g3uDwamAApYLJn941tyTCs h23Mloexzq8XKlDoIiLRwolnOR+vjsFqoLH2TLOwmnqSdl5nbv5IMDhnB18/H/0uIH TQQQvelizuEU+IPzM9lvGa+/E2U0PZ47/u5JWr0dJ8aOIHh49yWIifWkkDgK7bGQW3 rr1vPJNO1nZlg== Date: Wed, 18 Dec 2024 06:04:53 -1000 From: Tejun Heo To: Andrea Righi Cc: David Vernet , Changwoo Min , Yury Norov , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] sched/topology: introduce for_each_numa_hop_node() / sched_numa_hop_node() Message-ID: References: <20241217094156.577262-1-arighi@nvidia.com> <20241217094156.577262-2-arighi@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hello, On Wed, Dec 18, 2024 at 11:23:40AM +0100, Andrea Righi wrote: ... > > So, this would work but given that there is nothing dynamic about this > > ordering, would it make more sense to build the ordering and store it > > per-node? Then, the iteration just becomes walking that array. > > I've also considered doing that. I don't know if it'd work with offline > nodes, but maybe we can just check node_online(node) at each iteration and > skip those that are not online. Yeah, there can be e.g. for_each_possible_node_by_dist() where nodes with unknown distances (offline ones?) are put at the end and then there's also for_each_online_node_by_dist() which filters out offline ones, and the ordering can be updated from a CPU hotplug callback. The ordering can be probably put in an rcu protected array? I'm not sure what's the synchronization convention around node on/offlining. Is that protected together with CPU on/offlining? Given that there usually aren't that many nodes, the current implementation is probably fine too, so please feel free to ignore this suggestion for now too. Thanks. -- tejun