aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index dd618eb026aa..6914fcad4673 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -175,6 +175,7 @@ struct notifier_block;
175 175
176#ifdef CONFIG_MODULES 176#ifdef CONFIG_MODULES
177 177
178extern int modules_disabled; /* for sysctl */
178/* Get/put a kernel symbol (calls must be symmetric) */ 179/* Get/put a kernel symbol (calls must be symmetric) */
179void *__symbol_get(const char *symbol); 180void *__symbol_get(const char *symbol);
180void *__symbol_get_gpl(const char *symbol); 181void *__symbol_get_gpl(const char *symbol);
@@ -329,8 +330,11 @@ struct module
329 struct module_notes_attrs *notes_attrs; 330 struct module_notes_attrs *notes_attrs;
330#endif 331#endif
331 332
333#ifdef CONFIG_SMP
332 /* Per-cpu data. */ 334 /* Per-cpu data. */
333 void *percpu; 335 void __percpu *percpu;
336 unsigned int percpu_size;
337#endif
334 338
335 /* The command line arguments (may be mangled). People like 339 /* The command line arguments (may be mangled). People like
336 keeping pointers to this stuff */ 340 keeping pointers to this stuff */
@@ -364,7 +368,8 @@ struct module
364 void (*exit)(void); 368 void (*exit)(void);
365 369
366 struct module_ref { 370 struct module_ref {
367 int count; 371 unsigned int incs;
372 unsigned int decs;
368 } __percpu *refptr; 373 } __percpu *refptr;
369#endif 374#endif
370 375
@@ -391,6 +396,7 @@ static inline int module_is_live(struct module *mod)
391struct module *__module_text_address(unsigned long addr); 396struct module *__module_text_address(unsigned long addr);
392struct module *__module_address(unsigned long addr); 397struct module *__module_address(unsigned long addr);
393bool is_module_address(unsigned long addr); 398bool is_module_address(unsigned long addr);
399bool is_module_percpu_address(unsigned long addr);
394bool is_module_text_address(unsigned long addr); 400bool is_module_text_address(unsigned long addr);
395 401
396static inline int within_module_core(unsigned long addr, struct module *mod) 402static inline int within_module_core(unsigned long addr, struct module *mod)
@@ -458,9 +464,8 @@ static inline void __module_get(struct module *module)
458{ 464{
459 if (module) { 465 if (module) {
460 preempt_disable(); 466 preempt_disable();
461 __this_cpu_inc(module->refptr->count); 467 __this_cpu_inc(module->refptr->incs);
462 trace_module_get(module, _THIS_IP_, 468 trace_module_get(module, _THIS_IP_);
463 __this_cpu_read(module->refptr->count));
464 preempt_enable(); 469 preempt_enable();
465 } 470 }
466} 471}
@@ -473,11 +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 __this_cpu_read(module->refptr->count)); 483 } else
479 }
480 else
481 ret = 0; 484 ret = 0;
482 485
483 preempt_enable(); 486 preempt_enable();
@@ -562,6 +565,11 @@ static inline bool is_module_address(unsigned long addr)
562 return false; 565 return false;
563} 566}
564 567
568static inline bool is_module_percpu_address(unsigned long addr)
569{
570 return false;
571}
572
565static inline bool is_module_text_address(unsigned long addr) 573static inline bool is_module_text_address(unsigned long addr)
566{ 574{
567 return false; 575 return false;