mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: davidm@hpl.hp.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] per-cpu change
Date: Sat, 03 May 2003 14:40:57 +1000	[thread overview]
Message-ID: <20030503044617.DE0642C003@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 02 May 2003 09:51:30 MST." <16050.41490.798865.517036@napali.hpl.hp.com>

In message <16050.41490.798865.517036@napali.hpl.hp.com> you write:
>  - On NUMA, you want to allocate the per-CPU areas in node-local memory.

Thanks: I'd forgotten about this.  Even "big smp" machines often have
different memory latencies.

I need to allow archs to override the core allocation.

>  - It's important to initialize the per-CPU area early enough.  We
>    currently do it in cpu_init().  Anything later would probably break
>    things.

Yep, I imagine you'd explicitly call setup_per_cpu_areas() in
cpu_init.  (the later call will do nothing).

> 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.

Yes.  In fact, you get a boot error not a link error in my
implementation.

My previous implementation used a linked-list of memory chunks, like
so:

	Core kernel percpu	First dynamic percpu     Second dynamic percpu
	+----+----+---...-+  -> +----+----+---...-+  -> +----+----+---...-+ ->
	 CPU0 CPU1 CPU2...

You can then use the same __per_cpu_offset[], as the spacing between
each cpu's variables in the dynamically allocated sections is the same
as in the core kernel.  You can __alloc_percpu any size up to the
initial inter-cpu spacing (which was equal to the initial amount of
static per-cpu data, or 4k, whatever is more).

But if the cpu's variables are not consecutive (ie your NUMA point),
this scheme breaks down: you'd need to allocate areas with the same
spacing between them, which won't happen.

So I think the current, simpler choice is preferable.

> But the alternative of using something similar to the user-level TLS
> model doesn't look exactly attractive either.

Yes, I spoke with Alan Modra about what he had to do on PPC64, and ran
screaming.  We can live with more constraints, in the kernel, I think,
especially when the result is so fast and simple.

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

  reply	other threads:[~2003-05-03  4:33 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
2003-05-03  4:40   ` Rusty Russell [this message]
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=20030503044617.DE0642C003@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=davidm@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®