Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1238754

Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping
Date 2015-10-03 09:50 +0200
Message-ID <qfpJU-3Pm-11@gated-at.bofh.it> (permalink)
References <qfe25-46r-5@gated-at.bofh.it> <qfe26-46r-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* 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
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] x86/apic: Rename MAX_LOCAL_APIC to MAX_LOCAL_APICID Denys Vlasenko <dvlasenk@redhat.com> - 2015-10-02 21:20 +0200
  [PATCH 2/3] x86/apic: Make apic_version[] smaller Denys Vlasenko <dvlasenk@redhat.com> - 2015-10-02 21:20 +0200
  [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[] mapping Denys Vlasenko <dvlasenk@redhat.com> - 2015-10-02 21:20 +0200
    Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[]  mapping Ingo Molnar <mingo@kernel.org> - 2015-10-03 09:50 +0200
      Re: [PATCH 3/3] x86/apic: Use smaller array for __apicid_to_node[]  mapping Denys Vlasenko <dvlasenk@redhat.com> - 2015-10-03 22:30 +0200
      [PATCH v2] x86/apic: Use smaller array for __apicid_to_node[] mapping Daniel J Blueman <daniel@numascale.com> - 2015-10-05 06:40 +0200

csiph-web