lkml.org 
[lkml]   [2015]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping

* Denys Vlasenko <dvlasenk@redhat.com> 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


\
 
 \ /
  Last update: 2015-10-03 10:01    [W:0.144 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site