diff options
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 3cb7839a60b9..4598bf03e98b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -205,6 +205,20 @@ enum module_state | |||
205 | MODULE_STATE_GOING, | 205 | MODULE_STATE_GOING, |
206 | }; | 206 | }; |
207 | 207 | ||
208 | /** | ||
209 | * struct module_ref - per cpu module reference counts | ||
210 | * @incs: number of module get on this cpu | ||
211 | * @decs: number of module put on this cpu | ||
212 | * | ||
213 | * We force an alignment on 8 or 16 bytes, so that alloc_percpu() | ||
214 | * put @incs/@decs in same cache line, with no extra memory cost, | ||
215 | * since alloc_percpu() is fine grained. | ||
216 | */ | ||
217 | struct module_ref { | ||
218 | unsigned long incs; | ||
219 | unsigned long decs; | ||
220 | } __attribute((aligned(2 * sizeof(unsigned long)))); | ||
221 | |||
208 | struct module | 222 | struct module |
209 | { | 223 | { |
210 | enum module_state state; | 224 | enum module_state state; |
@@ -347,10 +361,7 @@ struct module | |||
347 | /* Destruction function. */ | 361 | /* Destruction function. */ |
348 | void (*exit)(void); | 362 | void (*exit)(void); |
349 | 363 | ||
350 | struct module_ref { | 364 | struct module_ref __percpu *refptr; |
351 | unsigned int incs; | ||
352 | unsigned int decs; | ||
353 | } __percpu *refptr; | ||
354 | #endif | 365 | #endif |
355 | 366 | ||
356 | #ifdef CONFIG_CONSTRUCTORS | 367 | #ifdef CONFIG_CONSTRUCTORS |
@@ -434,7 +445,7 @@ extern void __module_put_and_exit(struct module *mod, long code) | |||
434 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); | 445 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); |
435 | 446 | ||
436 | #ifdef CONFIG_MODULE_UNLOAD | 447 | #ifdef CONFIG_MODULE_UNLOAD |
437 | unsigned int module_refcount(struct module *mod); | 448 | unsigned long module_refcount(struct module *mod); |
438 | void __symbol_put(const char *symbol); | 449 | void __symbol_put(const char *symbol); |
439 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) | 450 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) |
440 | void symbol_put_addr(void *addr); | 451 | void symbol_put_addr(void *addr); |