Skip to content

Commit d790be3

Browse files
committed
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module updates from Rusty Russell: "The exciting thing here is the getting rid of stop_machine on module removal. This is possible by using a simple atomic_t for the counter, rather than our fancy per-cpu counter: it turns out that no one is doing a module increment per net packet, so the slowdown should be in the noise" * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: param: do not set store func without write perm params: cleanup sysfs allocation kernel:module Fix coding style errors and warnings. module: Remove stop_machine from module unloading module: Replace module_ref with atomic_t refcnt lib/bug: Use RCU list ops for module_bug_list module: Unlink module with RCU synchronizing instead of stop_machine module: Wait for RCU synchronizing before releasing a module
2 parents 64ec45b + b0a65b0 commit d790be3

5 files changed

Lines changed: 137 additions & 168 deletions

File tree

‎include/linux/module.h‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,20 +210,6 @@ enum module_state {
210210
MODULE_STATE_UNFORMED, /* Still setting it up. */
211211
};
212212

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-
227213
struct module {
228214
enum module_state state;
229215

@@ -367,7 +353,7 @@ struct module {
367353
/* Destruction function. */
368354
void (*exit)(void);
369355

370-
struct module_ref __percpu *refptr;
356+
atomic_t refcnt;
371357
#endif
372358

373359
#ifdef CONFIG_CONSTRUCTORS

‎include/trace/events/module.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
8080

8181
TP_fast_assign(
8282
__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);
8484
__assign_str(name, mod->name);
8585
),
8686

0 commit comments

Comments
 (0)