Skip to content

Commit

Permalink
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/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
  • Loading branch information
torvalds committed Dec 19, 2014
2 parents 64ec45b + b0a65b0 commit d790be3
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 168 deletions.
16 changes: 1 addition & 15 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,6 @@ enum module_state {
MODULE_STATE_UNFORMED, /* Still setting it up. */
};

/**
* struct module_ref - per cpu module reference counts
* @incs: number of module get on this cpu
* @decs: number of module put on this cpu
*
* We force an alignment on 8 or 16 bytes, so that alloc_percpu()
* put @incs/@decs in same cache line, with no extra memory cost,
* since alloc_percpu() is fine grained.
*/
struct module_ref {
unsigned long incs;
unsigned long decs;
} __attribute((aligned(2 * sizeof(unsigned long))));

struct module {
enum module_state state;

Expand Down Expand Up @@ -367,7 +353,7 @@ struct module {
/* Destruction function. */
void (*exit)(void);

struct module_ref __percpu *refptr;
atomic_t refcnt;
#endif

#ifdef CONFIG_CONSTRUCTORS
Expand Down
2 changes: 1 addition & 1 deletion include/trace/events/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(module_refcnt,

TP_fast_assign(
__entry->ip = ip;
__entry->refcnt = __this_cpu_read(mod->refptr->incs) - __this_cpu_read(mod->refptr->decs);
__entry->refcnt = atomic_read(&mod->refcnt);
__assign_str(name, mod->name);
),

Expand Down
Loading

0 comments on commit d790be3

Please sign in to comment.