Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
  module: add stub for is_module_percpu_address
  percpu, module: implement and use is_kernel/module_percpu_address()
  module: encapsulate percpu handling better and record percpu_size
This commit is contained in:
Linus Torvalds 2010-04-05 09:16:37 -07:00
commit 9e74e7c81a
5 changed files with 121 additions and 48 deletions

View file

@ -330,8 +330,11 @@ struct module
struct module_notes_attrs *notes_attrs;
#endif
#ifdef CONFIG_SMP
/* Per-cpu data. */
void *percpu;
void __percpu *percpu;
unsigned int percpu_size;
#endif
/* The command line arguments (may be mangled). People like
keeping pointers to this stuff */
@ -392,6 +395,7 @@ static inline int module_is_live(struct module *mod)
struct module *__module_text_address(unsigned long addr);
struct module *__module_address(unsigned long addr);
bool is_module_address(unsigned long addr);
bool is_module_percpu_address(unsigned long addr);
bool is_module_text_address(unsigned long addr);
static inline int within_module_core(unsigned long addr, struct module *mod)
@ -563,6 +567,11 @@ static inline bool is_module_address(unsigned long addr)
return false;
}
static inline bool is_module_percpu_address(unsigned long addr)
{
return false;
}
static inline bool is_module_text_address(unsigned long addr)
{
return false;

View file

@ -137,6 +137,7 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
extern void __percpu *__alloc_percpu(size_t size, size_t align);
extern void free_percpu(void __percpu *__pdata);
extern bool is_kernel_percpu_address(unsigned long addr);
extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
@ -163,6 +164,12 @@ static inline void free_percpu(void __percpu *p)
kfree(p);
}
/* can't distinguish from other static vars, always false */
static inline bool is_kernel_percpu_address(unsigned long addr)
{
return false;
}
static inline phys_addr_t per_cpu_ptr_to_phys(void *addr)
{
return __pa(addr);