From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@osdl.org>,
linux-mips@linux-mips.org,
David Mosberger-Tang <davidm@hpl.hp.com>,
linux-ia64@vger.kernel.org,
Martin Mares <mj@atrey.karlin.mff.cuni.cz>,
spyro@f2s.com, Christoph Lameter <clameter@engr.sgi.com>,
Joe Taylor <joe@tensilica.com>, Andi Kleen <ak@suse.de>,
linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
benedict.gaster@superh.com, bjornw@axis.com,
Ingo Molnar <mingo@elte.hu>,
Nick Piggin <nickpiggin@yahoo.com.au>,
grundler@parisc-linux.org, rusty@rustcorp.com.au,
Steven Rostedt <rostedt@goodmis.org>,
starvik@axis.com, Linus Torvalds <torvalds@osdl.org>,
Thomas Gleixner <tglx@linutronix.de>,
rth@twiddle.net, Chris Zankel <chris@zankel.net>,
tony.luck@intel.com, LKML <linux-kernel@vger.kernel.org>,
ralf@linux-mips.org, Marc Gauthier <marc@tensilica.com>,
lethal@linux-sh.org, schwidefsky@de.ibm.com, linux390@de.ibm.com,
davem@davemloft.net, parisc-linux@parisc-linux.org
Subject: Re: [PATCH 00/05] robust per_cpu allocation for modules
Date: Mon, 17 Apr 2006 13:06:06 -0700 [thread overview]
Message-ID: <20060417200606.GA3945@localhost.localdomain> (raw)
In-Reply-To: <200604161734.20256.arnd@arndb.de>
On Sun, Apr 16, 2006 at 05:34:18PM +0200, Arnd Bergmann wrote:
> On Sunday 16 April 2006 15:40, Steven Rostedt wrote:
> > I'll think more about this, but maybe someone else has some crazy ideas
> > that can find a solution to this that is both fast and robust.
>
> Ok, you asked for a crazy idea, you're going to get it ;-)
>
> You could take a fixed range from the vmalloc area (e.g. 1MB per cpu)
> and use that to remap pages on demand when you need per cpu data.
>
> #define PER_CPU_BASE 0xe000000000000000UL /* arch dependant */
> #define PER_CPU_SHIFT 0x100000UL
> #define __per_cpu_offset(__cpu) (PER_CPU_BASE + PER_CPU_STRIDE * (__cpu))
> #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
> #define __get_cpu_var(var) per_cpu(var, smp_processor_id())
>
> This is a lot like the current sparc64 implementation already is.
>
> The tricky part here is the remapping of pages. You'd need to
> alloc_pages_node() new pages whenever the already reserved space is
> not enough for the module you want to load and then map_vm_area()
> them into the space reserved for them.
>
> Advantages of this solution are:
> - no dependant load access for per_cpu()
> - might be flexible enough to implement a faster per_cpu_ptr()
> - can be combined with ia64-style per-cpu remapping
An implemenation similar to one you are mentioning was already proposed
sometime back.
http://lwn.net/Articles/119532/
The design was also meant to not restrict/limit per-cpu memory being
allocated from modules. Maybe it was too early then, and maybe now is the
right time, going by the interest in this thread :). IMHO, a new solution
should fix both static and dynamic per-cpu allocators,
- Avoid possibility of false sharing for dynamically allocated per-CPU data
(with current alloc percpu)
- work early enough -- if alloc_percpu can work early enough, (we can use
that for counters like slab cachep stats which is currently racy; using
atomic_t for them would be bad for performance)
An extra dereference in Steven's original proposal is bad, (I had done some
measurements earlier). My implementation had one less reference compared to
static per-cpu allocators, but the performance of both were the same as
the __per_cpu_offset table is always cache hot.
>
> Disadvantages are:
> - you can't use huge tlbs for mapping per cpu data like the
> regular linear mapping -> may be slower on some archs
Yep, we waste a few tlb entries then, which is a bit of concern, but then we
might be able to use hugetlbs for blocks of per-cpu data and minimize the
impact.
Thanks,
Kiran
next prev parent reply other threads:[~2006-04-17 21:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-14 21:18 [PATCH 00/05] robust per_cpu allocation for modules Steven Rostedt
2006-04-14 22:06 ` Andrew Morton
2006-04-14 22:12 ` Steven Rostedt
2006-04-14 22:12 ` Chen, Kenneth W
2006-04-15 3:10 ` [PATCH 00/08] robust per_cpu allocation for modules - V2 Steven Rostedt
2006-04-15 5:32 ` [PATCH 00/05] robust per_cpu allocation for modules Nick Piggin
2006-04-15 20:17 ` Steven Rostedt
2006-04-16 2:47 ` Nick Piggin
2006-04-16 3:53 ` Steven Rostedt
2006-04-16 7:02 ` Paul Mackerras
2006-04-16 13:40 ` Steven Rostedt
2006-04-16 14:03 ` Sam Ravnborg
2006-04-16 15:34 ` Arnd Bergmann
2006-04-16 18:03 ` Tony Luck
2006-04-17 0:45 ` Steven Rostedt
2006-04-17 2:07 ` Arnd Bergmann
2006-04-17 2:17 ` Steven Rostedt
2006-04-17 20:06 ` Ravikiran G Thirumalai [this message]
2006-04-17 6:47 ` Rusty Russell
2006-04-17 11:33 ` Steven Rostedt
2006-04-16 7:06 ` Nick Piggin
2006-04-16 16:06 ` Steven Rostedt
2006-04-17 17:10 ` Andi Kleen
2006-04-17 16:55 ` Christoph Lameter
2006-04-17 22:02 ` Ravikiran G Thirumalai
2006-04-17 23:44 ` Steven Rostedt
2006-04-17 23:48 ` Christoph Lameter
2006-04-18 1:51 ` Steven Rostedt
2006-04-18 6:42 ` Nick Piggin
2006-04-18 12:47 ` Steven Rostedt
2006-04-16 6:35 ` Paul Mackerras
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=20060417200606.GA3945@localhost.localdomain \
--to=kiran@scalex86.org \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--cc=benedict.gaster@superh.com \
--cc=bjornw@axis.com \
--cc=chris@zankel.net \
--cc=clameter@engr.sgi.com \
--cc=davem@davemloft.net \
--cc=davidm@hpl.hp.com \
--cc=grundler@parisc-linux.org \
--cc=joe@tensilica.com \
--cc=lethal@linux-sh.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux390@de.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=marc@tensilica.com \
--cc=mingo@elte.hu \
--cc=mj@atrey.karlin.mff.cuni.cz \
--cc=nickpiggin@yahoo.com.au \
--cc=parisc-linux@parisc-linux.org \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=rostedt@goodmis.org \
--cc=rth@twiddle.net \
--cc=rusty@rustcorp.com.au \
--cc=schwidefsky@de.ibm.com \
--cc=spyro@f2s.com \
--cc=starvik@axis.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).