Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1393872pxj; Fri, 21 May 2021 13:09:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhurJnhH92Zreru2dZnPmGc42dyY6U5OjlJo/2zN0eMnddrElOrQHBqPt4FZchdbM8eeE5 X-Received: by 2002:a6b:144e:: with SMTP id 75mr509241iou.62.1621627748661; Fri, 21 May 2021 13:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621627748; cv=none; d=google.com; s=arc-20160816; b=lwEsgU9SOcggW4DlJKUjYQUTCQt+8KIY5Pd9F7Ry2p8bfsLA3Z6DiP2rpL+SbqIYXZ UqM+VzOnU32RNANql41y0xYSG0D0sHeqbR0r+JCY4gKoLBpmb4DascPl9EKuYo4KLy9H KgeAQYnkTW8FnhtDeJy1eevHhRiyTEITmiiDAbcF6JbAEUAud4ieRaFUduyC0jNfwbV4 xFSPLi9B/o5YDZxiZv4cvWCNaapYrBHaty20ptMDMYehl/5tJy4+dPj8FjPi6E2f/IOk VIGFduFPls2NsaPa9ocXyHdCu81Xmd3QYlZlvHz1RhtMnQGPoOWnwH0WLQTRKJ0470oQ wdUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mcRfy6HSmsu84isB+mxfm8MQNLT8UwDpMQi9nSI58SY=; b=CvHBLlwXkykqtzFBj1sBmPanESSKJgxzr6BbZStixwPDkLESHoHBje5Vk4P8S3649r fIDFjgy2J6mIW+gitomYMYN5ZJX8t0w2dtOsoz8v/TWizK/JJw+AAeTEgtEbc8U5i03W 1oc0ur7i8b1VWcMXf3tiMJY+qiAI4wnb1iXZ5ByfMgYCPbEjqawlCJHC/B0REyaQ4pw/ MIFSlPUB9fk5FynfLvJwe/HnaYDG5St2JLmQ2yMmJOLq6ZTakG0tJYzYg2V547FoG6Zd IDgCkxcR4jFurRp094Csl9SYrN9BYPhcYC7zY1CubABboO1xpCM/fw6nCbe/5JaBve3i uWtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GSPONVPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si6148868ilj.132.2021.05.21.13.08.56; Fri, 21 May 2021 13:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GSPONVPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbhEUIUQ (ORCPT + 99 others); Fri, 21 May 2021 04:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbhEUIUD (ORCPT ); Fri, 21 May 2021 04:20:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999FFC0613CE for ; Fri, 21 May 2021 01:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mcRfy6HSmsu84isB+mxfm8MQNLT8UwDpMQi9nSI58SY=; b=GSPONVPzAhJ/4S+7ak09tygOuL Aw7gbHwPg4KU7ghUSI6Lv+2mtx+vMH1pQkMq5i9of9CjUfVHs1le+kNKpCm8PkR07mV31WK7APHPY 0AWtt7/2dVLszkbmmu19v42JtbPrIJuhZ3TaWvZ22oXdvHc0DhcVr9j+YhGeHdwJDQ2sEO1T/0TiN E43oBTaXEYDzV654UAOqjAT9lgeo66RWh0FKdi7mEHxRQuwu0sMvBWQQRcXAVV4UeJ5P6zQXpP10V YHPOcTGo+rBaLyEqKaRzokVd+lBEfAUiJeI43NBGpikLZRyr4wngqHuGaHsr4y1IPI+1FaqSMgwKJ /6HrTr3w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lk0IO-00Glzo-7N; Fri, 21 May 2021 08:14:34 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BFB92300103; Fri, 21 May 2021 10:14:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7D2792C6D2B89; Fri, 21 May 2021 10:14:10 +0200 (CEST) Date: Fri, 21 May 2021 10:14:10 +0200 From: Peter Zijlstra To: Srikar Dronamraju Cc: Ingo Molnar , LKML , Mel Gorman , Rik van Riel , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Dietmar Eggemann , linuxppc-dev@lists.ozlabs.org, Nathan Lynch , Michael Ellerman , Scott Cheloha , Gautham R Shenoy , Geetika Moolchandani Subject: Re: [PATCH 1/3] sched/topology: Allow archs to populate distance map Message-ID: References: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com> <20210520154427.1041031-2-srikar@linux.vnet.ibm.com> <20210521023802.GE2633526@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521023802.GE2633526@linux.vnet.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 08:08:02AM +0530, Srikar Dronamraju wrote: > * Peter Zijlstra [2021-05-20 20:56:31]: > > > On Thu, May 20, 2021 at 09:14:25PM +0530, Srikar Dronamraju wrote: > > > Currently scheduler populates the distance map by looking at distance > > > of each node from all other nodes. This should work for most > > > architectures and platforms. > > > > > > However there are some architectures like POWER that may not expose > > > the distance of nodes that are not yet onlined because those resources > > > are not yet allocated to the OS instance. Such architectures have > > > other means to provide valid distance data for the current platform. > > > > > > For example distance info from numactl from a fully populated 8 node > > > system at boot may look like this. > > > > > > node distances: > > > node 0 1 2 3 4 5 6 7 > > > 0: 10 20 40 40 40 40 40 40 > > > 1: 20 10 40 40 40 40 40 40 > > > 2: 40 40 10 20 40 40 40 40 > > > 3: 40 40 20 10 40 40 40 40 > > > 4: 40 40 40 40 10 20 40 40 > > > 5: 40 40 40 40 20 10 40 40 > > > 6: 40 40 40 40 40 40 10 20 > > > 7: 40 40 40 40 40 40 20 10 > > > > > > However the same system when only two nodes are online at boot, then the > > > numa topology will look like > > > node distances: > > > node 0 1 > > > 0: 10 20 > > > 1: 20 10 > > > > > > It may be implementation dependent on what node_distance(0,3) where > > > node 0 is online and node 3 is offline. In POWER case, it returns > > > LOCAL_DISTANCE(10). Here at boot the scheduler would assume that the max > > > distance between nodes is 20. However that would not be true. > > > > > > When Nodes are onlined and CPUs from those nodes are hotplugged, > > > the max node distance would be 40. > > > > > > To handle such scenarios, let scheduler allow architectures to populate > > > the distance map. Architectures that like to populate the distance map > > > can overload arch_populate_distance_map(). > > > > Why? Why can't your node_distance() DTRT? The arch interface is > > nr_node_ids and node_distance(), I don't see why we need something new > > and then replace one special use of it. > > > > By virtue of you being able to actually implement this new hook, you > > supposedly can actually do node_distance() right too. > > Since for an offline node, arch interface code doesn't have the info. > As far as I know/understand, in POWER, unless there is an active memory or > CPU that's getting onlined, arch can't fetch the correct node distance. > > Taking the above example: node 3 is offline, then node_distance of (3,X) > where X is anything other than 3, is not reliable. The moment node 3 is > onlined, the node distance is reliable. > > This problem will not happen even on POWER if all the nodes have either > memory or CPUs active at the time of boot. But then how can you implement this new hook? Going by the fact that both nr_node_ids and distance_ref_points_depth are fixed, how many possible __node_distance() configurations are there left? The example provided above does not suggest there's much room for alternatives, and hence for actual need of this new interface.