diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-31 16:32:31 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-05 21:30:01 (GMT) |
commit | 9d45cf9e36bf9bcf16df6e1cbf049807c8402823 (patch) | |
tree | 2118a16701418af10d215d2174df7ee0a5cbe6bd /include/linux/module.h | |
parent | a146649bc19d5eba4f5bfac6720c5f252d517a71 (diff) | |
parent | 0cd5c3c80a0ebd68c08312fa7d8c13149cc61c4c (diff) | |
download | linux-fsl-qoriq-9d45cf9e36bf9bcf16df6e1cbf049807c8402823.tar.xz |
Merge branch 'x86/urgent' into x86/apic
Conflicts:
arch/x86/mach-default/setup.c
Semantic merge:
arch/x86/kernel/irqinit_32.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 4f7ea12..f3b8329 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -219,11 +219,6 @@ void *__symbol_get_gpl(const char *symbol); #endif -struct module_ref -{ - local_t count; -} ____cacheline_aligned; - enum module_state { MODULE_STATE_LIVE, @@ -344,8 +339,11 @@ struct module /* Destruction function. */ void (*exit)(void); - /* Reference counts */ - struct module_ref ref[NR_CPUS]; +#ifdef CONFIG_SMP + char *refptr; +#else + local_t ref; +#endif #endif }; #ifndef MODULE_ARCH_INIT @@ -395,13 +393,22 @@ void __symbol_put(const char *symbol); #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) void symbol_put_addr(void *addr); +static inline local_t *__module_ref_addr(struct module *mod, int cpu) +{ +#ifdef CONFIG_SMP + return (local_t *) (mod->refptr + per_cpu_offset(cpu)); +#else + return &mod->ref; +#endif +} + /* Sometimes we know we already have a refcount, and it's easier not to handle the error case (which only happens with rmmod --wait). */ static inline void __module_get(struct module *module) { if (module) { BUG_ON(module_refcount(module) == 0); - local_inc(&module->ref[get_cpu()].count); + local_inc(__module_ref_addr(module, get_cpu())); put_cpu(); } } @@ -413,7 +420,7 @@ static inline int try_module_get(struct module *module) if (module) { unsigned int cpu = get_cpu(); if (likely(module_is_live(module))) - local_inc(&module->ref[cpu].count); + local_inc(__module_ref_addr(module, cpu)); else ret = 0; put_cpu(); |