Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2719283ybk; Tue, 12 May 2020 06:34:27 -0700 (PDT) X-Google-Smtp-Source: APiQypICToI0y4DKAQ/PgNKHhf7xWi4EfjKEL/wwOnsSA07LKgAywDdEklo0a+9NSwZm59IhSnBa X-Received: by 2002:a17:906:3004:: with SMTP id 4mr18265350ejz.381.1589290467785; Tue, 12 May 2020 06:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589290467; cv=none; d=google.com; s=arc-20160816; b=SjQXFC8sT6/BL/6e8F+AixyrkL2zY6icV46ZvognO87L1n3+XRGMG/rXIUjuAqgyJW PJoucEFBPcX31XsoKxBBb84Zd6In6seU0athVq0uLFfprOMwtKqXPteLBW/3Hsd3aV79 HiNffSezN0WuZm+Ww0pxXYTD1d6Kl1iwl9eXMAzILdfExADPUwE9fg3hpYdRPDymPZbU U8Woyb0be8PEkMFFzvSl9ZQBBjmuH0tUsGnJgcXvS1iSpxVxNt7RzMYJlpS5lQIwPNdT GXN7VIhvvUq/HstbYZWHrbBujSYRXQKhGeBYHFNdvV7dhmtRz+gOJWXUbft/SR4Tvue1 FBKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=67OCAalZMj0izBHY59kaxx8588nUXdDwRIPWiawkGHM=; b=MpQBQz3kPo9pAhycI7Oemdnk+LgLcRbUBHtivbd1W/XQ+lEUFaoQXOGlWwVoLLlCKN rx6DYGgE60iuCR8ql4R/M3oAWsUiLKKwBXfjnXcx7EjBNcC2dSr5Z3psdHI0QEvbCDTQ QSbqLErZ08czM8jcpclZX/xIkLSNddJ15P/Dji682pfL5/2/SpQaQV74X9xQPiBn8myw q6dQY/uUzj5Dnft+I3CnyEsv2oToMMk5QAIMftZfEulh2Q4PoJVAptUsxKYREA4GHt0C YbcGxY/W13nW1ZKmnQUOUYqMFMvgAO/LrSgVOQBc25pUuPwtvVyif14kH8zDOWhtV9ht Wkbg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l25si1183715eji.408.2020.05.12.06.34.03; Tue, 12 May 2020 06:34:27 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730014AbgELNaK (ORCPT + 99 others); Tue, 12 May 2020 09:30:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:18818 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgELNaI (ORCPT ); Tue, 12 May 2020 09:30:08 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04CD4Z9e011292; Tue, 12 May 2020 09:29:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30yv20sc3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 09:29:52 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04CD5jiM013817; Tue, 12 May 2020 09:29:51 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 30yv20sc2t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 09:29:51 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 04CDL5BG026750; Tue, 12 May 2020 13:29:49 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 30wm55ejmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 13:29:49 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04CDTlIX66125906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 May 2020 13:29:47 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D3A44203F; Tue, 12 May 2020 13:29:47 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F29EB4204C; Tue, 12 May 2020 13:29:43 +0000 (GMT) Received: from srikart450.in.ibm.com (unknown [9.199.47.102]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 12 May 2020 13:29:43 +0000 (GMT) From: Srikar Dronamraju To: Andrew Morton Cc: Srikar Dronamraju , linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko , Mel Gorman , Vlastimil Babka , "Kirill A. Shutemov" , Christopher Lameter , Michael Ellerman , Linus Torvalds , Gautham R Shenoy , Satheesh Rajendran , David Hildenbrand Subject: [PATCH v4 1/3] powerpc/numa: Set numa_node for all possible cpus Date: Tue, 12 May 2020 18:59:35 +0530 Message-Id: <20200512132937.19295-2-srikar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200512132937.19295-1-srikar@linux.vnet.ibm.com> References: <20200512132937.19295-1-srikar@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-12_03:2020-05-11,2020-05-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 bulkscore=0 clxscore=1015 spamscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005120094 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A Powerpc system with multiple possible nodes and with CONFIG_NUMA enabled always used to have a node 0, even if node 0 does not any cpus or memory attached to it. As per PAPR, node affinity of a cpu is only available once its present / online. For all cpus that are possible but not present, cpu_to_node() would point to node 0. To ensure a cpuless, memoryless dummy node is not online, powerpc need to make sure all possible but not present cpu_to_node are set to a proper node. Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Cc: Michal Hocko Cc: Mel Gorman Cc: Vlastimil Babka Cc: "Kirill A. Shutemov" Cc: Christopher Lameter Cc: Michael Ellerman Cc: Andrew Morton Cc: Linus Torvalds Cc: Gautham R Shenoy Cc: Satheesh Rajendran Cc: David Hildenbrand Signed-off-by: Srikar Dronamraju --- Changelog v3:->v4: - Resolved comments from Christopher. Link v3: http://lore.kernel.org/lkml/20200501031128.19584-1-srikar@linux.vnet.ibm.com/t/#u Changelog v1:->v2: - Rebased to v5.7-rc3 arch/powerpc/mm/numa.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 9fcf2d1..5b7918c 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -506,6 +506,11 @@ static int numa_setup_cpu(unsigned long lcpu) int fcpu = cpu_first_thread_sibling(lcpu); int nid = NUMA_NO_NODE; + if (!cpu_present(lcpu)) { + set_cpu_numa_node(lcpu, first_online_node); + return first_online_node; + } + /* * If a valid cpu-to-node mapping is already available, use it * directly instead of querying the firmware, since it represents @@ -931,8 +936,17 @@ void __init mem_topology_setup(void) reset_numa_cpu_lookup_table(); - for_each_present_cpu(cpu) + for_each_possible_cpu(cpu) { + /* + * Powerpc with CONFIG_NUMA always used to have a node 0, + * even if it was memoryless or cpuless. For all cpus that + * are possible but not present, cpu_to_node() would point + * to node 0. To remove a cpuless, memoryless dummy node, + * powerpc need to make sure all possible but not present + * cpu_to_node are set to a proper node. + */ numa_setup_cpu(cpu); + } } void __init initmem_init(void) -- 1.8.3.1