LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Andi Kleen <andi@firstfloor.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Allow per-cpu variables to be page-aligned
Date: Wed, 21 Mar 2007 03:21:01 -0600	[thread overview]
Message-ID: <m1ejnjc5qa.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <1174457426.11680.132.camel@localhost.localdomain> (Rusty Russell's message of "Wed, 21 Mar 2007 17:10:26 +1100")

Rusty Russell <rusty@rustcorp.com.au> writes:

> [This was part of the GDT cleanups and per-cpu-> pda changes, which I
> have revised, but this stands on its own.  The only change is catching
> the x86-64 per-cpu allocator too].
> ==
> Let's allow page-alignment in general for per-cpu data (wanted by Xen,
> and Ingo suggested KVM as well).
>
> Because larger alignments can use more room, we increase the max
> per-cpu memory to 64k rather than 32k: it's getting a little tight.
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Acked-by: Ingo Molnar <mingo@elte.hu>

> ===================================================================
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -346,10 +346,10 @@ static void *percpu_modalloc(unsigned lo
>  	unsigned int i;
>  	void *ptr;
>  
> -	if (align > SMP_CACHE_BYTES) {
> -		printk(KERN_WARNING "%s: per-cpu alignment %li > %i\n",
> -		       name, align, SMP_CACHE_BYTES);
> -		align = SMP_CACHE_BYTES;
> +	if (align > PAGE_SIZE) {
> +		printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n",
> +		       name, align, PAGE_SIZE);
> +		align = PAGE_SIZE;
>  	}
>  
>  	ptr = __per_cpu_start;
> @@ -430,7 +430,7 @@ static int percpu_modinit(void)
>  	pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated,
>  			    GFP_KERNEL);
>  	/* Static in-kernel percpu data (used). */
> -	pcpu_size[0] = -ALIGN(__per_cpu_end-__per_cpu_start, SMP_CACHE_BYTES);
> +	pcpu_size[0] = -ALIGN(__per_cpu_end-__per_cpu_start, PAGE_SIZE);
>  	/* Free room. */
>  	pcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0];
>  	if (pcpu_size[1] < 0) {

Do we really want to allow modules to be able to allocate page sized
per cpu memory.  If my memory servers on how this code works we will wind
up allocating 1 page of per cpu memory for every module that allocates a
per cpu variable.  128 bytes sucks 4k is an order of magnitude worse.

On x86_64 we are only reserving 8K for modules...

Eric

  parent reply	other threads:[~2007-03-21  9:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21  6:10 Rusty Russell
2007-03-21  6:30 ` [PATCH 0/4] i386 GDT cleanups Rusty Russell
2007-03-21  6:32   ` [PATCH 1/4] i386 GDT cleanups: Use per-cpu variables for GDT, PDA Rusty Russell
2007-03-21  6:35     ` [PATCH 2/4] i386 GDT cleanups: Use per-cpu GDT immediately upon boot Rusty Russell
2007-03-21  6:36       ` [PATCH 3/4] i386 GDT cleanups: clean up cpu_init() Rusty Russell
2007-03-21  6:53         ` [PATCH 4/4] i386 GDT cleanups: cleanup GDT Access Rusty Russell
2007-03-21  9:31       ` [PATCH 2/4] i386 GDT cleanups: Use per-cpu GDT immediately upon boot Eric W. Biederman
2007-03-21 11:55         ` Rusty Russell
2007-03-21 16:51           ` Eric W. Biederman
2007-03-21 23:58             ` Rusty Russell
2007-03-22  8:10               ` Sébastien Dugué
2007-03-22  9:24                 ` Rusty Russell
2007-03-22 15:59                   ` [PATCH] i386 GDT cleanups: Rename boot_gdt_table to boot_gdt Sébastien Dugué
2007-03-23  7:19                     ` Rusty Russell
2007-03-23 14:15                     ` Andi Kleen
2007-03-21  9:21 ` Eric W. Biederman [this message]
2007-03-21 11:44   ` [PATCH] Allow per-cpu variables to be page-aligned Rusty Russell
2007-03-21 16:49     ` Eric W. Biederman
2007-03-22  0:09       ` Rusty Russell

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=m1ejnjc5qa.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --subject='Re: [PATCH] Allow per-cpu variables to be page-aligned' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).