public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Andrew Morton <akpm@digeo.com>
Cc: mikpe@user.it.uu.se, linux-kernel@vger.kernel.org
Subject: Re: module changes
Date: Wed, 19 Feb 2003 15:28:52 +1100	[thread overview]
Message-ID: <20030219051523.BD7B92C28D@lists.samba.org> (raw)
In-Reply-To: Your message of "Tue, 18 Feb 2003 19:51:40 -0800." <20030218195140.27b0798f.akpm@digeo.com>

In message <20030218195140.27b0798f.akpm@digeo.com> you write:
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> > The problem is that then you have to have to know whether this is a
> > per-cpu thing created in a module, or not, when you use it 8(
> > 
> > There are two things we can use to alleviate the problem.  The first
> > would be to put a minimal cap on the per-cpu data size (eg. 8k).  The
> > other possibility is to allocate on an object granularity, in which
> > case the rule becomes "no single per-cpu object can be larger than
> > XXX", but the cost is to write a mini allocator.
> > 
> 
> Is kmalloc_percpu() not suitable?

Unfortunately, no.  You have to use the same offsets as the in-kernel
DEFINE_PER_CPU declarations, meaning that each cpu's stuff needs to be
"sizeof kernel per-cpu-section" apart.

Which means an allocator which keeps a linked list of NR_CPUS * sizeof
kernel-per-cpu-section things, and allocs and frees from that.

Hence this patch just tacks it on the end of the module, rather than
deal with an allocator.  A minor improvement would be only to allocate
for the maximum possible CPU, which means about 6k * numcpus per
module which declares per-cpu data, which is probably fine.

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

  reply	other threads:[~2003-02-19  5:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030217213221.3103.qmail@eklektix.com>
2003-02-18  7:19 ` module changes Rusty Russell
2003-02-18 15:56   ` Mikael Pettersson
2003-02-18 16:05     ` John Levon
2003-02-18 22:24     ` Rusty Russell
2003-02-19  3:51       ` Andrew Morton
2003-02-19  4:28         ` Rusty Russell [this message]
2003-02-19 12:52       ` Mikael Pettersson
2003-02-20  0:15         ` 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=20030219051523.BD7B92C28D@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@user.it.uu.se \
    /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