From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbbJCHod (ORCPT ); Sat, 3 Oct 2015 03:44:33 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:33531 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612AbbJCHoc (ORCPT ); Sat, 3 Oct 2015 03:44:32 -0400 Date: Sat, 3 Oct 2015 09:44:28 +0200 From: Ingo Molnar To: Denys Vlasenko Cc: Daniel J Blueman , Jiang Liu , Thomas Gleixner , Len Brown , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping Message-ID: <20151003074428.GA25143@gmail.com> References: <1443813145-29102-1-git-send-email-dvlasenk@redhat.com> <1443813145-29102-3-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443813145-29102-3-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Denys Vlasenko wrote: > @@ -56,16 +56,34 @@ early_param("numa", numa_setup); > /* > * apicid, cpu, node mappings > */ > -s16 __apicid_to_node[MAX_LOCAL_APICID] = { > - [0 ... MAX_LOCAL_APICID-1] = NUMA_NO_NODE > + > +struct apicid_to_node __apicid_to_node[NR_CPUS] = { > + [0 ... NR_CPUS-1] = {-1, NUMA_NO_NODE} > }; > > +void set_apicid_to_node(int apicid, s16 node) > +{ > + static int ent; having such statics inside functions is really obscure and makes review harder. I had to look twice to see it. Please move it outside and also name it appropriately. > + /* Protect against small kernel on large system */ > + if (ent >= NR_CPUS) > + return; > + > + __apicid_to_node[ent].apicid = apicid; > + __apicid_to_node[ent].node = node; > + ent++; > +} So what happens if we run a small kernel and run out of entries? We just silently seem to return, no warning, no nothing - the system will likely fail to boot in myserious ways, right? Thanks, Ingo