Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1594081ybh; Fri, 13 Mar 2020 04:07:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvtsZpXEKtbIHEJp584H3RUTDLd5rlS4BruGoIqPzYHWUVEAVHzyvlVUztdyD5qop7OpzqQ X-Received: by 2002:a9d:e83:: with SMTP id 3mr10336372otj.93.1584097629208; Fri, 13 Mar 2020 04:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584097629; cv=none; d=google.com; s=arc-20160816; b=tHhYlqugSogymrj1hUp1rCMyNIuPY98HbTuuBfj41sSHjnnA0fW2Tcdh2HwflWdmek /xB7eT7xqZNkRS3/AEJ28LGExCBCtGxd1N5VjhdJOXtCt6c0Sl7JX5OXSPixg48/xfFk Vu7OWtS5LJf57il5qPViCTgGLKAnEFkn9Sl9/KlwGzU1Xvp0hjAtDuRuTkmuW9Kq/ESM YBIyMRWv4pyllYlm9zdckYADUi/SO7f/4offVxwaPCfHfOaEoL07C2wXdVYk7bQbwKG+ AZnDOTTWoejPYh8bDZYvZnZfgdflbK7VhlDmPBjfW5ozYtVmg2ENlLU4ZVcpEE40XEKK oErA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=/IoztvaEPGOn1Ni6cWnqOeY++qrzHdP9aTucSMFrEuo=; b=MYTDI3wBS+NEZqPmeIX7SlHdEuZ/lcptZvx6HFa7syfm+4W03u/KhlU+irfXYZKF8G lgRT5XUAv97mVHHt5MefIg7jeDoUNkqNs662gMVqF0k+qr7JfFRbIC2QHhf0Ggt5iGJd VK3OFKW8zW/BVq34VZiP1+wI31QphwlRukxgNWPN9UXCZZP2RAR65qI91raF4gRV58MO APBavAYhx7slvj7cpujoc1OtLQvfMzRpgUAp+V2Ji6rCn4oL6eKo+4/RHHRae+YgTXWq CxRxSCNfVuVyNki0jJn0Ju7e4KVkI1RWqA3qkYfCZknOBAFhRb07GLNhwA/VyRQ+iILP Mpww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v203si4385002oif.224.2020.03.13.04.06.55; Fri, 13 Mar 2020 04:07:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726689AbgCMLEz (ORCPT + 99 others); Fri, 13 Mar 2020 07:04:55 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50432 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726387AbgCMLEz (ORCPT ); Fri, 13 Mar 2020 07:04:55 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02DB35ml076016 for ; Fri, 13 Mar 2020 07:04:53 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yqyhtamg5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 Mar 2020 07:04:52 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Mar 2020 11:04:49 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 13 Mar 2020 11:04:45 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02DB4ivV40239484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Mar 2020 11:04:44 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02E884204F; Fri, 13 Mar 2020 11:04:44 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8041D4204D; Fri, 13 Mar 2020 11:04:41 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av24.portsmouth.uk.ibm.com (Postfix) with SMTP; Fri, 13 Mar 2020 11:04:41 +0000 (GMT) Date: Fri, 13 Mar 2020 16:34:40 +0530 From: Srikar Dronamraju To: Joonsoo Kim Cc: Vlastimil Babka , Sachin Sant , Michal Hocko , Linus Torvalds , LKML , Linux Memory Management List , Mel Gorman , "Kirill A. Shutemov" , Andrew Morton , linuxppc-dev , Christopher Lameter , Joonsoo Kim , Kirill Tkhai Subject: Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus Reply-To: Srikar Dronamraju References: <20200311110237.5731-2-srikar@linux.vnet.ibm.com> <20200311115735.GM23944@dhcp22.suse.cz> <20200312052707.GA3277@linux.vnet.ibm.com> <5e5c736a-a88c-7c76-fc3d-7bc765e8dcba@suse.cz> <20200312131438.GB3277@linux.vnet.ibm.com> <61437352-8b54-38fa-4471-044a65c9d05a@suse.cz> <20200312161310.GC3277@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 x-cbid: 20031311-0012-0000-0000-0000039069FE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20031311-0013-0000-0000-000021CD3F2C Message-Id: <20200313110440.GA25144@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-13_04:2020-03-12,2020-03-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003130060 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Joonsoo Kim [2020-03-13 18:47:49]: > > >> > > >> > Also for a memoryless/cpuless node or possible but not present nodes, > > >> > node_to_mem_node(node) will still end up as node (atleast on powerpc). > > >> > > >> I think that's the place where this would be best to fix. > > >> > > > > > > Maybe. I thought about it but the current set_numa_mem semantics are apt > > > for memoryless cpu node and not for possible nodes. We could have upto 256 > > > possible nodes and only 2 nodes (1,2) with cpu and 1 node (1) with memory. > > > node_to_mem_node seems to return what is set in set_numa_mem(). > > > set_numa_mem() seems to say set my numa_mem node for the current memoryless > > > node to the param passed. > > > > > > But how do we set numa_mem for all the other 253 possible nodes, which > > > probably will have 0 as default? > > > > > > Should we introduce another API such that we could update for all possible > > > nodes? > > > > If we want to rely on node_to_mem_node() to give us something safe for each > > possible node, then probably it would have to be like that, yeah. > > > > >> > I tried with this hunk below and it works. > > >> > > > >> > But I am not sure if we need to check at other places were > > >> > node_present_pages is being called. > > >> > > >> I think this seems to defeat the purpose of node_to_mem_node()? Shouldn't it > > >> return only nodes that are online with present memory? > > >> CCing Joonsoo who seems to have introduced this in ad2c8144418c ("topology: add > > >> support for node_to_mem_node() to determine the fallback node") > > >> > > > > > > Agree > > I lost all the memory about it. :) > Anyway, how about this? > > 1. make node_present_pages() safer > static inline node_present_pages(nid) > { > if (!node_online(nid)) return 0; > return (NODE_DATA(nid)->node_present_pages); > } > Yes this would help. > 2. make node_to_mem_node() safer for all cases > In ppc arch's mem_topology_setup(void) > for_each_present_cpu(cpu) { > numa_setup_cpu(cpu); > mem_node = node_to_mem_node(numa_mem_id()); > if (!node_present_pages(mem_node)) { > _node_numa_mem_[numa_mem_id()] = first_online_node; > } > } > But here as discussed above, we miss the case of possible but not present nodes. For such nodes, the above change may not update, resulting in they still having 0. And node 0 can be only possible but not present. -- Thanks and Regards Srikar Dronamraju