From: Tejun Heo <tj@kernel.org>
To: mingo@elte.hu, rusty@rustcorp.com.au, tglx@linutronix.de,
x86@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com,
efault@gmx.de, jaswinder@kernel.org, cooloney@kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 1/8] percpu: clean up percpu constants
Date: Fri, 6 Mar 2009 15:46:21 +0900 [thread overview]
Message-ID: <1236321988-19457-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1236321988-19457-1-git-send-email-tj@kernel.org>
Impact: cleaup
Make the following cleanups.
* There isn't much arch-specific about PERCPU_MODULE_RESERVE. Always
define it whether arch overrides PERCPU_ENOUGH_ROOM or not.
* blackfin overrides PERCPU_ENOUGH_ROOM to align static area size. Do
it by default.
* percpu allocation sizes doesn't have much to do with the page size.
Don't use PAGE_SHIFT in their definition.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Bryan Wu <cooloney@kernel.org>
---
arch/blackfin/include/asm/percpu.h | 10 ----------
include/linux/percpu.h | 24 +++++++++++++-----------
2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/blackfin/include/asm/percpu.h b/arch/blackfin/include/asm/percpu.h
index 797c0c1..c94c7bc 100644
--- a/arch/blackfin/include/asm/percpu.h
+++ b/arch/blackfin/include/asm/percpu.h
@@ -3,14 +3,4 @@
#include <asm-generic/percpu.h>
-#ifdef CONFIG_MODULES
-#define PERCPU_MODULE_RESERVE 8192
-#else
-#define PERCPU_MODULE_RESERVE 0
-#endif
-
-#define PERCPU_ENOUGH_ROOM \
- (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
- PERCPU_MODULE_RESERVE)
-
#endif /* __ARCH_BLACKFIN_PERCPU__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 545b068..2d34b03 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -5,6 +5,7 @@
#include <linux/slab.h> /* For kmalloc() */
#include <linux/smp.h>
#include <linux/cpumask.h>
+#include <linux/pfn.h>
#include <asm/percpu.h>
@@ -52,17 +53,18 @@
#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
-/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
-#ifndef PERCPU_ENOUGH_ROOM
+/* enough to cover all DEFINE_PER_CPUs in modules */
#ifdef CONFIG_MODULES
-#define PERCPU_MODULE_RESERVE 8192
+#define PERCPU_MODULE_RESERVE (8 << 10)
#else
-#define PERCPU_MODULE_RESERVE 0
+#define PERCPU_MODULE_RESERVE 0
#endif
+#ifndef PERCPU_ENOUGH_ROOM
#define PERCPU_ENOUGH_ROOM \
- (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE)
-#endif /* PERCPU_ENOUGH_ROOM */
+ (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
+ PERCPU_MODULE_RESERVE)
+#endif
/*
* Must be an lvalue. Since @var must be a simple identifier,
@@ -79,7 +81,7 @@
#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
/* minimum unit size, also is the maximum supported allocation size */
-#define PCPU_MIN_UNIT_SIZE (16UL << PAGE_SHIFT)
+#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
/*
* PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
@@ -96,15 +98,15 @@
#ifndef PERCPU_DYNAMIC_RESERVE
# if BITS_PER_LONG > 32
# ifdef CONFIG_MODULES
-# define PERCPU_DYNAMIC_RESERVE (6 << PAGE_SHIFT)
+# define PERCPU_DYNAMIC_RESERVE (24 << 10)
# else
-# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
+# define PERCPU_DYNAMIC_RESERVE (16 << 10)
# endif
# else
# ifdef CONFIG_MODULES
-# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
+# define PERCPU_DYNAMIC_RESERVE (16 << 10)
# else
-# define PERCPU_DYNAMIC_RESERVE (2 << PAGE_SHIFT)
+# define PERCPU_DYNAMIC_RESERVE (8 << 10)
# endif
# endif
#endif /* PERCPU_DYNAMIC_RESERVE */
--
1.6.0.2
next prev parent reply other threads:[~2009-03-06 6:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 6:46 [GIT PULL] x86, percpu: implement and use reserved percpu alloc Tejun Heo
2009-03-06 6:46 ` Tejun Heo [this message]
2009-03-08 5:01 ` [PATCH 1/8] percpu: clean up percpu constants Bryan Wu
2009-03-06 6:46 ` [PATCH 2/8] percpu: cosmetic renames in pcpu_setup_first_chunk() Tejun Heo
2009-03-06 6:46 ` [PATCH 3/8] percpu: improve first chunk initial area map handling Tejun Heo
2009-03-06 6:46 ` [PATCH 4/8] percpu: use negative for auto for pcpu_setup_first_chunk() arguments Tejun Heo
2009-03-06 6:46 ` [PATCH 5/8] x86: make embedding percpu allocator return excessive free space Tejun Heo
2009-03-06 6:46 ` [PATCH 6/8] percpu: add an indirection ptr for chunk page map access Tejun Heo
2009-03-06 6:46 ` [PATCH 7/8] percpu, module: implement reserved allocation and use it for module percpu variables Tejun Heo
2009-03-06 6:46 ` [PATCH 8/8] x86, percpu: setup reserved percpu area for x86_64 Tejun Heo
2009-03-06 7:29 ` [GIT PULL] x86, percpu: implement and use reserved percpu alloc Mike Galbraith
2009-03-06 8:06 ` Ingo Molnar
2009-03-08 4:37 ` Bryan Wu
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=1236321988-19457-2-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=cooloney@kernel.org \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=jaswinder@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--cc=x86@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