From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751608AbdJRUJI (ORCPT ); Wed, 18 Oct 2017 16:09:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39530 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbdJRUJG (ORCPT ); Wed, 18 Oct 2017 16:09:06 -0400 To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Michael Ellerman , Michael Bringmann , John Allen , Nathan Fontenot , Tyrel Datwyler , Thomas Falcon In-Reply-To: From: Michael Bringmann Subject: [PATCH V2 2/3] pseries/findnodes: Find nodes with memory for memoryless nodes Organization: IBM Linux Technology Center Date: Wed, 18 Oct 2017 15:09:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17101820-0056-0000-0000-000003DBA9FF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007915; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000237; SDB=6.00933045; UDB=6.00469922; IPR=6.00713335; BA=6.00005648; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017596; XFM=3.00000015; UTC=2017-10-18 20:09:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101820-0057-0000-0000-00000812B12A Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-18_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710180278 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pseries/findnodes: On pseries systems which allow 'hot-add' of resources, we may boot configurations that have CPUs, but no memory associated to a node by the affinity calculations. Previously, the software took a shortcut to collapse initialization and references to such memoryless nodes with other nodes that did have memory associated with them at boot. This patch is based on fixes that allow the proper initialization and distinguishment of memoryless and memory-plus nodes after NUMA initialization. It extends the use of the 'node_to_mem_node()' API from 'topology.h' to modules that are allocating node-specific memory at boot, and allows such references to find available memory in another node. Signed-off-by: Michael Bringmann --- block/blk-mq-cpumap.c | 3 ++- mm/page_alloc.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 9f8cffc..a27a31f 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -73,7 +73,8 @@ int blk_mq_hw_queue_to_node(unsigned int *mq_map, unsigned int index) for_each_possible_cpu(i) { if (index == mq_map[i]) - return local_memory_node(cpu_to_node(i)); + return local_memory_node( + node_to_mem_node(cpu_to_node(i))); } return NUMA_NO_NODE; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 77e4d3c..e7aaa2a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4188,6 +4188,7 @@ struct page * gfp_mask &= gfp_allowed_mask; alloc_mask = gfp_mask; + preferred_nid = node_to_mem_node(preferred_nid); if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) return NULL;