All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: ak@suse.de, linux-kernel@vger.kernel.org, travis@sgi.com
Subject: Re: x86: Convert cpu_core_map to be a per cpu variable
Date: Fri, 13 Jul 2007 06:49:55 -0700	[thread overview]
Message-ID: <46978303.6030004@goop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0707122354340.17278@schroedinger.engr.sgi.com>

Christoph Lameter wrote:
> cpu_core_map is currently an array defined using NR_CPUS. This means that
> we overallocate since we will rarely really use the maximum 
> number of configured cpus. This may become a problem when we need to 
> increase the NR_CPUs on x86_64 for our new product line.
>
> If we put the cpu_core_map into the per cpu area then it will be allocated
> for each processor as it comes online.
>
> However, this means that the core map cannot be accessed until the per cpu 
> area has been allocated. Xen does a weird thing here looping over all 
> processors and zeroing the masks that are not yet allocated and that will 
> be zeroed when they are allocated. I commented the code out. Maybe there 
> is another purpose? Jeremy?
>   

That code is identical to the code in smp_boot_cpus().  Not sure why it 
needs to be there twice though.  Perhaps it doesn't need to be there at all.

> @@ -1107,11 +1107,11 @@ static void __init smp_boot_cpus(unsigne
>  	 */
>  	for (cpu = 0; cpu < NR_CPUS; cpu++) {
>  		cpus_clear(cpu_sibling_map[cpu]);
> -		cpus_clear(cpu_core_map[cpu]);
> +		cpus_clear(per_cpu(cpu_core_map, cpu));
>  	}
>  
>  	cpu_set(0, cpu_sibling_map[0]);
> -	cpu_set(0, cpu_core_map[0]);
> +	cpu_set(0, per_cpu(cpu_core_map, 0));
>   

> ===================================================================
> --- linux-2.6.22-rc6-mm1.orig/arch/i386/xen/smp.c	2007-07-12 23:32:37.000000000 -0700
> +++ linux-2.6.22-rc6-mm1/arch/i386/xen/smp.c	2007-07-12 23:52:08.000000000 -0700
> @@ -150,7 +150,12 @@ void __init xen_smp_prepare_boot_cpu(voi
>  
>  	for (cpu = 0; cpu < NR_CPUS; cpu++) {
>  		cpus_clear(cpu_sibling_map[cpu]);
> -		cpus_clear(cpu_core_map[cpu]);
> +		/*
> +		 * cpu_core_map lives in a per cpu area that is cleared
> +		 * when the per cpu array is allocated.
> +		 *
> +		 * cpus_clear(per_cpu(cpu_core_map, cpu));
> +		 */
>  	}
>  }
>  
> @@ -160,7 +165,11 @@ void __init xen_smp_prepare_cpus(unsigne
>  
>  	for (cpu = 0; cpu < NR_CPUS; cpu++) {
>  		cpus_clear(cpu_sibling_map[cpu]);
> -		cpus_clear(cpu_core_map[cpu]);
> +		/*
> +		 * cpu_core_ map will be zeroed when the per cpu area is allocated.
> +		 *
> +		 * cpus_clear(per_cpu(cpu_core_map, cpu));
> +		 */
>  	}
>  
>  	smp_store_cpu_info(0);
>   

    J

  parent reply	other threads:[~2007-07-13 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13  6:58 x86: Convert cpu_core_map to be a per cpu variable Christoph Lameter
2007-07-13  7:08 ` David Miller
2007-07-13 16:34   ` Christoph Lameter
2007-07-13 22:41     ` David Miller
2007-07-13 22:50       ` Christoph Lameter
2007-07-13 22:51         ` David Miller
2007-07-13 13:49 ` Jeremy Fitzhardinge [this message]
2007-07-17 19:27 ` Siddha, Suresh B
2007-07-23 19:34   ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46978303.6030004@goop.org \
    --to=jeremy@goop.org \
    --cc=ak@suse.de \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=travis@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.