Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932076AbbKWWE5 (ORCPT ); Mon, 23 Nov 2015 17:04:57 -0500 Received: from mail-yk0-f181.google.com ([209.85.160.181]:36061 "EHLO mail-yk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbbKWWEz (ORCPT ); Mon, 23 Nov 2015 17:04:55 -0500 Date: Mon, 23 Nov 2015 17:04:51 -0500 From: Tejun Heo To: Tang Chen Cc: cl@linux.com, jiang.liu@linux.intel.com, mika.j.penttila@gmail.com, mingo@redhat.com, akpm@linux-foundation.org, rjw@rjwysocki.net, hpa@zytor.com, yasu.isimatu@gmail.com, isimatu.yasuaki@jp.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com, izumi.taku@jp.fujitsu.com, gongzhaogang@inspur.com, x86@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/5] Make cpuid <-> nodeid mapping persistent. Message-ID: <20151123220451.GG19072@mtj.duckdns.org> References: <1447906935-31899-1-git-send-email-tangchen@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447906935-31899-1-git-send-email-tangchen@cn.fujitsu.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1744 Lines: 42 Hello, On Thu, Nov 19, 2015 at 12:22:10PM +0800, Tang Chen wrote: > [Solution] > > There are four mappings in the kernel: > 1. nodeid (logical node id) <-> pxm > 2. apicid (physical cpu id) <-> nodeid > 3. cpuid (logical cpu id) <-> apicid > 4. cpuid (logical cpu id) <-> nodeid > > 1. pxm (proximity domain) is provided by ACPI firmware in SRAT, and nodeid <-> pxm > mapping is setup at boot time. This mapping is persistent, won't change. > > 2. apicid <-> nodeid mapping is setup using info in 1. The mapping is setup at boot > time and CPU hotadd time, and cleared at CPU hotremove time. This mapping is also > persistent. > > 3. cpuid <-> apicid mapping is setup at boot time and CPU hotadd time. cpuid is > allocated, lower ids first, and released at CPU hotremove time, reused for other > hotadded CPUs. So this mapping is not persistent. > > 4. cpuid <-> nodeid mapping is also setup at boot time and CPU hotadd time, and > cleared at CPU hotremove time. As a result of 3, this mapping is not persistent. > > To fix this problem, we establish cpuid <-> nodeid mapping for all the possible > cpus at boot time, and make it persistent. And according to init_cpu_to_node(), > cpuid <-> nodeid mapping is based on apicid <-> nodeid mapping and cpuid <-> apicid > mapping. So the key point is obtaining all cpus' apicid. I don't know much about acpi so can't actually review the patches but the overall approach looks good to me. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/