mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: David Mosberger-Tang <davidm@hpl.hp.com>,
	ak@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] per-cpu change
Date: Fri, 2 May 2003 09:51:30 -0700	[thread overview]
Message-ID: <16050.41490.798865.517036@napali.hpl.hp.com> (raw)
In-Reply-To: <20030502084610.0C8AC2C0BF@lists.samba.org>

>>>>> On Fri, 02 May 2003 18:28:34 +1000, Rusty Russell <rusty@rustcorp.com.au> said:

  Rusty> Hi David, To implement kmalloc_percpu to use the same
  Rusty> primitives that normal (static) per-cpu vars use, I have made
  Rusty> some changes.  This is required for sane per-cpu variable
  Rusty> support in modules, but the implementation also makes
  Rusty> allocation v. efficient.  I've had to make more assumptions
  Rusty> about the per-cpu layout though.

  Rusty> 	IA64 is the only arch which doesn't use the generic
  Rusty> struct (x86-64 seems to be partway 8), so I wanted to check
  Rusty> with you.  Basically, we over-allocate up front, and pass out
  Rusty> the rest through the __alloc_percpu interface.  I've made the
  Rusty> setup_per_cpu_areas() idempotent, so you should simply be
  Rusty> able to call that from your cpu_init() (the later generic
  Rusty> call will do nothing).

  Rusty> 	Please tell me if this is too restrictive for IA64.
  Rusty> Ideally it should be a simplification: you just need to
  Rusty> override __get_cpu_var(var) and __get_cpu_ptr(var) for SMP in
  Rusty> asm/percpu.h.  You might want to set PERCPU_POOL_SIZE (16k
  Rusty> would be plenty for my machine, but you currently do 64k).

We pin the per-CPU area into the TLB, so the size of this area is
limited to one of the supported page sizes (yes, we _could_ pin
multiple TLB entries, but I do not think that would be economical).
At the moment, we use a 64KB page size.  So as long as the per-CPU
area is guaranteed never to be bigger than that, we should be fine.

Two other comments:

 - On NUMA, you want to allocate the per-CPU areas in node-local memory.
 - It's important to initialize the per-CPU area early enough.  We
   currently do it in cpu_init().  Anything later would probably break
   things.

I am a little concerned with supporting per-CPU storage in modules.
What happens if the per-CPU area fills up?  With the normal kernel,
you'll get a link-time error, but with modules, you won't know until
you try to insert a module.  But the alternative of using something
similar to the user-level TLS model doesn't look exactly attractive
either.

	--david

  reply	other threads:[~2003-05-02 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02  8:28 Rusty Russell
2003-05-02 16:51 ` David Mosberger [this message]
2003-05-03  4:40   ` Rusty Russell
2003-05-03  4:53     ` William Lee Irwin III

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=16050.41490.798865.517036@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=ak@suse.de \
    --cc=davidm@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®