diff options
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 393ec39b580a..6914fcad4673 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -330,8 +330,11 @@ struct module | |||
330 | struct module_notes_attrs *notes_attrs; | 330 | struct module_notes_attrs *notes_attrs; |
331 | #endif | 331 | #endif |
332 | 332 | ||
333 | #ifdef CONFIG_SMP | ||
333 | /* Per-cpu data. */ | 334 | /* Per-cpu data. */ |
334 | void *percpu; | 335 | void __percpu *percpu; |
336 | unsigned int percpu_size; | ||
337 | #endif | ||
335 | 338 | ||
336 | /* The command line arguments (may be mangled). People like | 339 | /* The command line arguments (may be mangled). People like |
337 | keeping pointers to this stuff */ | 340 | keeping pointers to this stuff */ |
@@ -365,7 +368,8 @@ struct module | |||
365 | void (*exit)(void); | 368 | void (*exit)(void); |
366 | 369 | ||
367 | struct module_ref { | 370 | struct module_ref { |
368 | int count; | 371 | unsigned int incs; |
372 | unsigned int decs; | ||
369 | } __percpu *refptr; | 373 | } __percpu *refptr; |
370 | #endif | 374 | #endif |
371 | 375 | ||
@@ -392,6 +396,7 @@ static inline int module_is_live(struct module *mod) | |||
392 | struct module *__module_text_address(unsigned long addr); | 396 | struct module *__module_text_address(unsigned long addr); |
393 | struct module *__module_address(unsigned long addr); | 397 | struct module *__module_address(unsigned long addr); |
394 | bool is_module_address(unsigned long addr); | 398 | bool is_module_address(unsigned long addr); |
399 | bool is_module_percpu_address(unsigned long addr); | ||
395 | bool is_module_text_address(unsigned long addr); | 400 | bool is_module_text_address(unsigned long addr); |
396 | 401 | ||
397 | static inline int within_module_core(unsigned long addr, struct module *mod) | 402 | static inline int within_module_core(unsigned long addr, struct module *mod) |
@@ -459,7 +464,7 @@ static inline void __module_get(struct module *module) | |||
459 | { | 464 | { |
460 | if (module) { | 465 | if (module) { |
461 | preempt_disable(); | 466 | preempt_disable(); |
462 | __this_cpu_inc(module->refptr->count); | 467 | __this_cpu_inc(module->refptr->incs); |
463 | trace_module_get(module, _THIS_IP_); | 468 | trace_module_get(module, _THIS_IP_); |
464 | preempt_enable(); | 469 | preempt_enable(); |
465 | } | 470 | } |
@@ -473,10 +478,9 @@ static inline int try_module_get(struct module *module) | |||
473 | preempt_disable(); | 478 | preempt_disable(); |
474 | 479 | ||
475 | if (likely(module_is_live(module))) { | 480 | if (likely(module_is_live(module))) { |
476 | __this_cpu_inc(module->refptr->count); | 481 | __this_cpu_inc(module->refptr->incs); |
477 | trace_module_get(module, _THIS_IP_); | 482 | trace_module_get(module, _THIS_IP_); |
478 | } | 483 | } else |
479 | else | ||
480 | ret = 0; | 484 | ret = 0; |
481 | 485 | ||
482 | preempt_enable(); | 486 | preempt_enable(); |
@@ -561,6 +565,11 @@ static inline bool is_module_address(unsigned long addr) | |||
561 | return false; | 565 | return false; |
562 | } | 566 | } |
563 | 567 | ||
568 | static inline bool is_module_percpu_address(unsigned long addr) | ||
569 | { | ||
570 | return false; | ||
571 | } | ||
572 | |||
564 | static inline bool is_module_text_address(unsigned long addr) | 573 | static inline bool is_module_text_address(unsigned long addr) |
565 | { | 574 | { |
566 | return false; | 575 | return false; |