From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753177AbbI0S3D (ORCPT ); Sun, 27 Sep 2015 14:29:03 -0400 Received: from e18.ny.us.ibm.com ([129.33.205.208]:41431 "EHLO e18.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbbI0S2o (ORCPT ); Sun, 27 Sep 2015 14:28:44 -0400 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: raghavendra.kt@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org From: Raghavendra K T To: , , Cc: , , , , , , , , , Subject: [PATCH RFC 5/5] powerpc:numa Use chipid to nid mapping to get serial numa node ids Date: Sun, 27 Sep 2015 23:59:13 +0530 Message-Id: <1443378553-2146-6-git-send-email-raghavendra.kt@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1443378553-2146-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com> References: <1443378553-2146-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15092718-0045-0000-0000-0000019C7D7A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Also properly initialize numa distance table for serial nids. Problem: Powerpc supports sparse nid numbering which could affect 1) memory footprint 2) virtualization use cases Current solution: The patch maps sprase chipid got fromn device tree to serail nids. Result before: node 0 1 16 17 0: 10 20 40 40 1: 20 10 40 40 16: 40 40 10 20 17: 40 40 20 10 After: node 0 1 2 3 0: 10 20 40 40 1: 20 10 40 40 2: 40 40 10 20 3: 40 40 20 10 Testing: Scenarios tested on baremetal and KVM guest with 4 nodes 1) offlining and onlining memory and cpus 2) Running the tests from numactl source. 3) Creating 1000s of docker containers stressing the system Signed-off-by: Raghavendra K T --- arch/powerpc/mm/numa.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index f015cad..873ac8c 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -304,7 +304,8 @@ static int associativity_to_chipid(const __be32 *associativity) /* * Skip the length field and send start of associativity array */ - initialize_distance_lookup_table(chipid, associativity + 1); + initialize_distance_lookup_table(chipid_to_nid(chipid), + associativity + 1); } out: @@ -314,9 +315,10 @@ out: /* Return the nid from associativity */ static int associativity_to_nid(const __be32 *associativity) { - int nid; + int chipid, nid; - nid = associativity_to_chipid(associativity); + chipid = associativity_to_chipid(associativity); + nid = map_chipid_to_nid(chipid); return nid; } @@ -340,9 +342,10 @@ static int of_node_to_chipid_single(struct device_node *device) */ static int of_node_to_nid_single(struct device_node *device) { - int nid; + int chipid, nid; - nid = of_node_to_chipid_single(device); + chipid = of_node_to_chipid_single(device); + nid = map_chipid_to_nid(chipid); return nid; } -- 1.7.11.7