Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2719674ybk; Tue, 12 May 2020 06:35:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsQPSfXkfLxGcGWtoPCbeu06W4y9pbtNIvBTnSFh/RkZnz0sws/g2J3Hma6PlqNXLslU5S X-Received: by 2002:a05:6402:17a3:: with SMTP id j3mr9609378edy.137.1589290502286; Tue, 12 May 2020 06:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589290502; cv=none; d=google.com; s=arc-20160816; b=PNLWxpz7MbGBwZzlTtfOoM/ltzeVCkRDCbM/AfGmFCxzTebbeGwiwenL6bMu6BAzVv xwRAWvcY2ZI0c6C0jW/F7LoFBt0zoBFgcwYHCweaVQXSY57etJJTiFT+eZE24biwbHxA V4/ezvSF4LYu90/rc5yGZb2iXcD90HZPpxjVfP2ECjS1zMlmF90YScTm+kZJDODexaNt s1ybB5zB5lUw2as2DTCiVEOxeYdRipzrY6MaTSV0FHwY5EPxs3AEprILMcjt6ashVh6I 03OcTMrNXGnoLO5lpcW4RRtC9SntseShNz1ZcbwH8ZxaGY9TB4cKQjXt3PA904gPMVYb HpbQ== 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=tWhBFUMyU/jK1i4IF1JSdyaJCnxyduYXbzAstyWDDxU=; b=CtGzSt556TO5R/aQNr/RPRr9jWIpuVR1iDLXtLhQkISCxTMj/e3kARtbZRRkevD+nW JNMNo2Hf2RxIecdrosEcFB43CKW9QjdGzTl3x6vQyqJ3qstqxOZ3Md+rJTdbASX07NH+ lwaECvDRNWnMWL3HRFmoFrGmvCwrqPUSvd1cFmvbrD9590XL6Jwhwkh4/chA4lBVp99u 2OvZzojfkzvL1VaxymQs3yHBoShL+4Ee0PfS0D2xxsrx7C6kFm/KzeRi46o/sApJzxTp /itO802rIHSNvK5DYelJh4hywqNj2iUci/BFhNhsDfPhKbiT3d0/gpGcw8fc3VMjBn+B 90Tg== 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 ca5si4399456ejb.27.2020.05.12.06.34.38; Tue, 12 May 2020 06:35:02 -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 S1730046AbgELNaU (ORCPT + 99 others); Tue, 12 May 2020 09:30:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41300 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgELNaT (ORCPT ); Tue, 12 May 2020 09:30:19 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04CD5kP8050352; Tue, 12 May 2020 09:30:02 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 30wsc49q1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 09:30:02 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04CD6IW7053558; Tue, 12 May 2020 09:30:02 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 30wsc49q0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 09:30:02 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 04CDLA6l024967; Tue, 12 May 2020 13:30:00 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 30wm55pjcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 May 2020 13:30:00 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04CDTwFs9699686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 May 2020 13:29:58 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AB8F42047; Tue, 12 May 2020 13:29:58 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDCB842041; Tue, 12 May 2020 13:29:47 +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:47 +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 2/3] powerpc/numa: Prefer node id queried from vphn Date: Tue, 12 May 2020 18:59:36 +0530 Message-Id: <20200512132937.19295-3-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 phishscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 spamscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 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 Node id queried from the static device tree may not be correct. For example: it may always show 0 on a shared processor. Hence prefer the node id queried from vphn and fallback on the device tree based node id if vphn query fails. 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 v2:->v3: - Resolved comments from Gautham. Link v2: https://lore.kernel.org/linuxppc-dev/20200428093836.27190-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, 8 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index b3615b7..2815313 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -719,20 +719,20 @@ static int __init parse_numa_properties(void) */ for_each_present_cpu(i) { struct device_node *cpu; - int nid; - - cpu = of_get_cpu_node(i, NULL); - BUG_ON(!cpu); - nid = of_node_to_nid_single(cpu); - of_node_put(cpu); + int nid = vphn_get_nid(i); /* * Don't fall back to default_nid yet -- we will plug * cpus into nodes once the memory scan has discovered * the topology. */ - if (nid < 0) - continue; - node_set_online(nid); + if (nid == NUMA_NO_NODE) { + cpu = of_get_cpu_node(i, NULL); + BUG_ON(!cpu); + nid = of_node_to_nid_single(cpu); + of_node_put(cpu); + } + + if (likely(nid > 0)) + node_set_online(nid); } get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells); -- 1.8.3.1