percpu: clean up percpu constants
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>
This commit is contained in:
parent
f254f3909e
commit
6a242909b0
2 changed files with 13 additions and 21 deletions
|
@ -3,14 +3,4 @@
|
||||||
|
|
||||||
#include <asm-generic/percpu.h>
|
#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__ */
|
#endif /* __ARCH_BLACKFIN_PERCPU__ */
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <linux/slab.h> /* For kmalloc() */
|
#include <linux/slab.h> /* For kmalloc() */
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
|
#include <linux/pfn.h>
|
||||||
|
|
||||||
#include <asm/percpu.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(var) EXPORT_SYMBOL(per_cpu__##var)
|
||||||
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(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. */
|
/* enough to cover all DEFINE_PER_CPUs in modules */
|
||||||
#ifndef PERCPU_ENOUGH_ROOM
|
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
#define PERCPU_MODULE_RESERVE 8192
|
#define PERCPU_MODULE_RESERVE (8 << 10)
|
||||||
#else
|
#else
|
||||||
#define PERCPU_MODULE_RESERVE 0
|
#define PERCPU_MODULE_RESERVE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PERCPU_ENOUGH_ROOM
|
||||||
#define PERCPU_ENOUGH_ROOM \
|
#define PERCPU_ENOUGH_ROOM \
|
||||||
(__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE)
|
(ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
|
||||||
#endif /* PERCPU_ENOUGH_ROOM */
|
PERCPU_MODULE_RESERVE)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be an lvalue. Since @var must be a simple identifier,
|
* Must be an lvalue. Since @var must be a simple identifier,
|
||||||
|
@ -79,7 +81,7 @@
|
||||||
#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
|
#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
|
||||||
|
|
||||||
/* minimum unit size, also is the maximum supported allocation size */
|
/* 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
|
* PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
|
||||||
|
@ -96,15 +98,15 @@
|
||||||
#ifndef PERCPU_DYNAMIC_RESERVE
|
#ifndef PERCPU_DYNAMIC_RESERVE
|
||||||
# if BITS_PER_LONG > 32
|
# if BITS_PER_LONG > 32
|
||||||
# ifdef CONFIG_MODULES
|
# ifdef CONFIG_MODULES
|
||||||
# define PERCPU_DYNAMIC_RESERVE (6 << PAGE_SHIFT)
|
# define PERCPU_DYNAMIC_RESERVE (24 << 10)
|
||||||
# else
|
# else
|
||||||
# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
|
# define PERCPU_DYNAMIC_RESERVE (16 << 10)
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_MODULES
|
# ifdef CONFIG_MODULES
|
||||||
# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
|
# define PERCPU_DYNAMIC_RESERVE (16 << 10)
|
||||||
# else
|
# else
|
||||||
# define PERCPU_DYNAMIC_RESERVE (2 << PAGE_SHIFT)
|
# define PERCPU_DYNAMIC_RESERVE (8 << 10)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif /* PERCPU_DYNAMIC_RESERVE */
|
#endif /* PERCPU_DYNAMIC_RESERVE */
|
||||||
|
|
Loading…
Reference in a new issue