diff options
| author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-11-09 17:59:29 -0500 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-11-11 01:37:46 -0500 |
| commit | 2f35c41f58a978dfa44ffa102249d556caa99eeb (patch) | |
| tree | 871fdf31787639112af15e3532bb6617660f2e47 /include | |
| parent | 0286b5ea125e58b4797747f688949c05394412e8 (diff) | |
module: Replace module_ref with atomic_t refcnt
Replace module_ref per-cpu complex reference counter with
an atomic_t simple refcnt. This is for code simplification.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/module.h | 16 | ||||
| -rw-r--r-- | include/trace/events/module.h | 2 |
2 files changed, 2 insertions, 16 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 71f282a4e307..ebfb0e153c6a 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -210,20 +210,6 @@ enum module_state { | |||
| 210 | MODULE_STATE_UNFORMED, /* Still setting it up. */ | 210 | MODULE_STATE_UNFORMED, /* Still setting it up. */ |
| 211 | }; | 211 | }; |
| 212 | 212 | ||
| 213 | /** | ||
| 214 | * struct module_ref - per cpu module reference counts | ||
| 215 | * @incs: number of module get on this cpu | ||
| 216 | * @decs: number of module put on this cpu | ||
| 217 | * | ||
| 218 | * We force an alignment on 8 or 16 bytes, so that alloc_percpu() | ||
| 219 | * put @incs/@decs in same cache line, with no extra memory cost, | ||
| 220 | * since alloc_percpu() is fine grained. | ||
| 221 | */ | ||
| 222 | struct module_ref { | ||
| 223 | unsigned long incs; | ||
| 224 | unsigned long decs; | ||
| 225 | } __attribute((aligned(2 * sizeof(unsigned long)))); | ||
| 226 | |||
| 227 | struct module { | 213 | struct module { |
| 228 | enum module_state state; | 214 | enum module_state state; |
| 229 | 215 | ||
| @@ -367,7 +353,7 @@ struct module { | |||
| 367 | /* Destruction function. */ | 353 | /* Destruction function. */ |
| 368 | void (*exit)(void); | 354 | void (*exit)(void); |
| 369 | 355 | ||
| 370 | struct module_ref __percpu *refptr; | 356 | atomic_t refcnt; |
| 371 | #endif | 357 | #endif |
| 372 | 358 | ||
| 373 | #ifdef CONFIG_CONSTRUCTORS | 359 | #ifdef CONFIG_CONSTRUCTORS |
diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 7c5cbfe3fc49..81c4c183d348 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h | |||
| @@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(module_refcnt, | |||
| 80 | 80 | ||
| 81 | TP_fast_assign( | 81 | TP_fast_assign( |
| 82 | __entry->ip = ip; | 82 | __entry->ip = ip; |
| 83 | __entry->refcnt = __this_cpu_read(mod->refptr->incs) - __this_cpu_read(mod->refptr->decs); | 83 | __entry->refcnt = atomic_read(&mod->refcnt); |
| 84 | __assign_str(name, mod->name); | 84 | __assign_str(name, mod->name); |
| 85 | ), | 85 | ), |
| 86 | 86 | ||
