From: Tejun Heo <tj@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Prarit Bhargava <prarit@redhat.com>,
linux-kernel@vger.kernel.org, Mike Galbraith <efault@gmx.de>,
Josh Triplett <josh@joshtriplett.org>,
Tim Abbott <tabbott@ksplice.com>
Subject: Re: [PATCH] module, fix percpu reserved memory exhaustion
Date: Mon, 14 Jan 2013 09:18:22 -0800 [thread overview]
Message-ID: <20130114171822.GC27942@mtj.dyndns.org> (raw)
In-Reply-To: <87pq1byzum.fsf@rustcorp.com.au>
Hello, Rusty.
On Sat, Jan 12, 2013 at 11:36:09AM +1030, Rusty Russell wrote:
> > I've been thinking about that. The problem is that at the same time the kvm
> > problem occurs I'm attempting to load a debug module that I've written to debug
> > some cpu timer issues that allocates a large amount of percpu data (~.5K/cpu).
> > While extending PERCPU_MODULE_RESERVE to 10k might work now, it might not work
> > tomorrow if I have the need to increase the size of my log buffer.
>
> Well, it looks like PERCPU_MODULE_RESERVE is actually very generous; it
> could easily be halved. I guess this is because dynamic per-cpu data is
> now such a nice alternative (thanks to Tejun).
Heh, thanks. :)
There are two percpu constants that I basically pulled out of my ass.
* PERCPU_MODULE_RESERVE: It's used on architectures with data model
which restricts the distance between code and data. e.g. x86_64
genereates code which can't address full 64bit for static data and
as percpu addressing depends on the regular address generation to
derive percpu addresses, the percpu offsets need to be restricted
somehow. Percpu allocator currently achieves this by reserving
certain amount in the first percpu chunk which is guaranteed to have
very low (starting from 0) percpu address space offsets.
On those archs, this becomes the hard limit for all module static
percpu areas. Maybe 8k is way too high and we can go with 4k.
Worth a try I guess.
* PERCPU_DYNAMIC_RESERVE: The amount of space at the end of the first
chunk used for dynamic allocation. This isn't as critical as the
above and the only reason it exists is because the first chunk is
often embedded in the kernel linear address space instead of vmalloc
area and the former is often mapped with larger page table size than
the latter. The goal of PERCPU_DYNAMIC_RESERVE is to have just
enough space to cover the usual percpu allocations without wasting
too much space to minimize impact on TLB pressure.
The current number isn't entirely made up. I did some testing with
some random config. Don't know how it holds up now. It probably
can be increased given that we developed quite a few percpu dynamic
allocations since then.
It would be awesome to have a way to somehow dynamically adjust this
one; unfortunately, that would require persistent data across
boots. :(
Thanks.
--
tejun
prev parent reply other threads:[~2013-01-14 17:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 2:41 Prarit Bhargava
2013-01-11 3:48 ` Rusty Russell
2013-01-11 14:16 ` Prarit Bhargava
2013-01-12 1:06 ` Rusty Russell
2013-01-14 14:29 ` Prarit Bhargava
2013-01-14 17:18 ` Tejun Heo [this message]
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=20130114171822.GC27942@mtj.dyndns.org \
--to=tj@kernel.org \
--cc=efault@gmx.de \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=tabbott@ksplice.com \
/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®