1. 18 Sep, 2009 1 commit
  2. 28 Aug, 2009 1 commit
    • Ingo Molnar's avatar
      modules: Fix build error in the !CONFIG_KALLSYMS case · ea6bff36
      Ingo Molnar authored
      > James Bottomley (1):
      >       module: workaround duplicate section names
      
      -tip testing found that this patch breaks the build on x86 if
      CONFIG_KALLSYMS is disabled:
      
       kernel/module.c: In function ‘load_module’:
       kernel/module.c:2367: error: ‘struct module’ has no member named ‘sect_attrs’
       distcc[8269] ERROR: compile kernel/module.c on ph/32 failed
       make[1]: *** [kernel/module.o] Error 1
       make: *** [kernel] Error 2
       make: *** Waiting for unfinished jobs....
      
      Commit 1b364bf4 misses the fact that section attributes are only
      built and dealt with if kallsyms is enabled. The patch below fixes
      this.
      
      ( note, technically speaking this should depend on CONFIG_SYSFS as
        well but this patch is correct too and keeps the #ifdef less
        intrusive - in the KALLSYMS && !SYSFS case the code is a NOP. )
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      [ Replaced patch with a slightly cleaner variation by James Bottomley ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ea6bff36
  3. 27 Aug, 2009 2 commits
  4. 17 Aug, 2009 1 commit
    • Li Zefan's avatar
      tracing/events: Add module tracepoints · 7ead8b83
      Li Zefan authored
      Add trace points to trace module_load, module_free, module_get,
      module_put and module_request, and use trace_event facility to
      get the trace output.
      
      Here's the sample output:
      
           TASK-PID    CPU#    TIMESTAMP  FUNCTION
              | |       |          |         |
          <...>-42    [000]     1.758380: module_request: fb0 wait=1 call_site=fb_open
          ...
          <...>-60    [000]     3.269403: module_load: scsi_wait_scan
          <...>-60    [000]     3.269432: module_put: scsi_wait_scan call_site=sys_init_module refcnt=0
          <...>-61    [001]     3.273168: module_free: scsi_wait_scan
          ...
          <...>-1021  [000]    13.836081: module_load: sunrpc
          <...>-1021  [000]    13.840589: module_put: sunrpc call_site=sys_init_module refcnt=-1
          <...>-1027  [000]    13.848098: module_get: sunrpc call_site=try_module_get refcnt=0
          <...>-1027  [000]    13.848308: module_get: sunrpc call_site=get_filesystem refcnt=1
          <...>-1027  [000]    13.848692: module_put: sunrpc call_site=put_filesystem refcnt=0
          ...
       modprobe-2587  [001]  1088.437213: module_load: trace_events_sample F
       modprobe-2587  [001]  1088.437786: module_put: trace_events_sample call_site=sys_init_module refcnt=0
      
      Note:
      
      - the taints flag can be 'F', 'C' and/or 'P' if mod->taints != 0
      
      - the module refcnt is percpu, so it can be negative in a
        specific cpu
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <4A891B3C.5030608@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7ead8b83
  5. 27 Jul, 2009 1 commit
  6. 08 Jul, 2009 1 commit
  7. 24 Jun, 2009 1 commit
    • Tejun Heo's avatar
      percpu: use dynamic percpu allocator as the default percpu allocator · e74e3962
      Tejun Heo authored
      This patch makes most !CONFIG_HAVE_SETUP_PER_CPU_AREA archs use
      dynamic percpu allocator.  The first chunk is allocated using
      embedding helper and 8k is reserved for modules.  This ensures that
      the new allocator behaves almost identically to the original allocator
      as long as static percpu variables are concerned, so it shouldn't
      introduce much breakage.
      
      s390 and alpha use custom SHIFT_PERCPU_PTR() to work around addressing
      range limit the addressing model imposes.  Unfortunately, this breaks
      if the address is specified using a variable, so for now, the two
      archs aren't converted.
      
      The following architectures are affected by this change.
      
      * sh
      * arm
      * cris
      * mips
      * sparc(32)
      * blackfin
      * avr32
      * parisc (broken, under investigation)
      * m32r
      * powerpc(32)
      
      As this change makes the dynamic allocator the default one,
      CONFIG_HAVE_DYNAMIC_PER_CPU_AREA is replaced with its invert -
      CONFIG_HAVE_LEGACY_PER_CPU_AREA, which is added to yet-to-be converted
      archs.  These archs implement their own setup_per_cpu_areas() and the
      conversion is not trivial.
      
      * powerpc(64)
      * sparc(64)
      * ia64
      * alpha
      * s390
      
      Boot and batch alloc/free tests on x86_32 with debug code (x86_32
      doesn't use default first chunk initialization).  Compile tested on
      sparc(32), powerpc(32), arm and alpha.
      
      Kyle McMartin reported that this change breaks parisc.  The problem is
      still under investigation and he is okay with pushing this patch
      forward and fixing parisc later.
      
      [ Impact: use dynamic allocator for most archs w/o custom percpu setup ]
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Reviewed-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Bryan Wu <cooloney@kernel.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Grant Grundler <grundler@parisc-linux.org>
      Cc: Hirokazu Takata <takata@linux-m32r.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      e74e3962
  8. 18 Jun, 2009 1 commit
  9. 16 Jun, 2009 1 commit
  10. 12 Jun, 2009 1 commit
    • Rusty Russell's avatar
      module: trim exception table on init free. · ad6561df
      Rusty Russell authored
      It's theoretically possible that there are exception table entries
      which point into the (freed) init text of modules.  These could cause
      future problems if other modules get loaded into that memory and cause
      an exception as we'd see the wrong fixup.  The only case I know of is
      kvm-intel.ko (when CONFIG_CC_OPTIMIZE_FOR_SIZE=n).
      
      Amerigo fixed this long-standing FIXME in the x86 version, but this
      patch is more general.
      
      This implements trim_init_extable(); most archs are simple since they
      use the standard lib/extable.c sort code.  Alpha and IA64 use relative
      addresses in their fixups, so thier trimming is a slight variation.
      
      Sparc32 is unique; it doesn't seem to define ARCH_HAS_SORT_EXTABLE,
      yet it defines its own sort_extable() which overrides the one in lib.
      It doesn't sort, so we have to mark deleted entries instead of
      actually trimming them.
      Inspired-by: default avatarAmerigo Wang <amwang@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: linux-alpha@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-ia64@vger.kernel.org
      ad6561df
  11. 11 Jun, 2009 1 commit
  12. 17 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      ftrace: use module notifier for function tracer · 93eb677d
      Steven Rostedt authored
      The hooks in the module code for the function tracer must be called
      before any of that module code runs. The function tracer hooks
      modify the module (replacing calls to mcount to nops). If the code
      is executed while the change occurs, then the CPU can take a GPF.
      
      To handle the above with a bit of paranoia, I originally implemented
      the hooks as calls directly from the module code.
      
      After examining the notifier calls, it looks as though the start up
      notify is called before any of the module's code is executed. This makes
      the use of the notify safe with ftrace.
      
      Only the startup notify is required to be "safe". The shutdown simply
      removes the entries from the ftrace function list, and does not modify
      any code.
      
      This change has another benefit. It removes a issue with a reverse dependency
      in the mutexes of ftrace_lock and module_mutex.
      
      [ Impact: fix lock dependency bug, cleanup ]
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      93eb677d
  13. 14 Apr, 2009 2 commits
    • Stephen Rothwell's avatar
      modules: Fix up build when CONFIG_MODULE_UNLOAD=n. · 19e4529e
      Stephen Rothwell authored
      Commit 3d43321b ("modules: sysctl to
      block module loading") introduces a modules_disabled variable that is
      only defined if CONFIG_MODULE_UNLOAD is enabled, despite being used in
      other places. This moves it up and fixes up the build.
      
        CC      kernel/module.o
      kernel/module.c: In function 'sys_init_module':
      kernel/module.c:2401: error: 'modules_disabled' undeclared (first use in this function)
      kernel/module.c:2401: error: (Each undeclared identifier is reported only once
      kernel/module.c:2401: error: for each function it appears in.)
      make[1]: *** [kernel/module.o] Error 1
      make: *** [kernel/module.o] Error 2
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      19e4529e
    • Steven Rostedt's avatar
      tracing/events: add support for modules to TRACE_EVENT · 6d723736
      Steven Rostedt authored
      Impact: allow modules to add TRACE_EVENTS on load
      
      This patch adds the final hooks to allow modules to use the TRACE_EVENT
      macro. A notifier and a data structure are used to link the TRACE_EVENTs
      defined in the module to connect them with the ftrace event tracing system.
      
      It also adds the necessary automated clean ups to the trace events when a
      module is removed.
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6d723736
  14. 11 Apr, 2009 1 commit
    • Linus Torvalds's avatar
      async: Fix module loading async-work regression · d6de2c80
      Linus Torvalds authored
      Several drivers use asynchronous work to do device discovery, and we
      synchronize with them in the compiled-in case before we actually try to
      mount root filesystems etc.
      
      However, when compiled as modules, that synchronization is missing - the
      module loading completes, but the driver hasn't actually finished
      probing for devices, and that means that any user mode that expects to
      use the devices after the 'insmod' is now potentially broken.
      
      We already saw one case of a similar issue in the ACPI battery code,
      where the kernel itself expected the module to be all done, and unmapped
      the init memory - but the async device discovery was still running.
      That got hacked around by just removing the "__init" (see commit
      5d38258e "ACPI battery: fix async boot
      oops"), but the real fix is to just make the module loading wait for all
      async work to be completed.
      
      It will slow down module loading, but since common devices should be
      built in anyway, and since the bug is really annoying and hard to handle
      from user space (and caused several S3 resume regressions), the simple
      fix to wait is the right one.
      
      This fixes at least
      
      	http://bugzilla.kernel.org/show_bug.cgi?id=13063
      
      but probably a few other bugzilla entries too (12936, for example), and
      is confirmed to fix Rafael's storage driver breakage after resume bug
      report (no bugzilla entry).
      
      We should also be able to now revert that ACPI battery fix.
      Reported-and-tested-by: default avatarRafael J. Wysocki <rjw@suse.com>
      Tested-by: default avatarHeinz Diehl <htd@fancy-poultry.org>
      Acked-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d6de2c80
  15. 07 Apr, 2009 1 commit
  16. 02 Apr, 2009 1 commit
    • Kees Cook's avatar
      modules: sysctl to block module loading · 3d43321b
      Kees Cook authored
      Implement a sysctl file that disables module-loading system-wide since
      there is no longer a viable way to remove CAP_SYS_MODULE after the system
      bounding capability set was removed in 2.6.25.
      
      Value can only be set to "1", and is tested only if standard capability
      checks allow CAP_SYS_MODULE.  Given existing /dev/mem protections, this
      should allow administrators a one-way method to block module loading
      after initial boot-time module loading has finished.
      Signed-off-by: default avatarKees Cook <kees.cook@canonical.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      3d43321b
  17. 30 Mar, 2009 12 commits
    • Rusty Russell's avatar
      module: use strstarts() · 49502677
      Rusty Russell authored
      Impact: minor cleanup.
      
      I'm not going to neaten anyone else's code, but I'm happy to clean up
      my own.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      49502677
    • Rusty Russell's avatar
      module: don't use stop_machine on module load · e91defa2
      Rusty Russell authored
      Kay Sievers <kay.sievers@vrfy.org> discovered that boot times are slowed
      by about half a second because all the stop_machine_create() calls,
      and he only probes about 40 modules (I have 125 loaded on this laptop).
      
      We only do stop_machine_create() so we can unlink the module if
      something goes wrong, but it's overkill (and buggy anyway: if
      stop_machine_create() fails we still call stop_machine_destroy()).
      
      Since we are only protecting against kallsyms (esp. oops) walking the
      list, synchronize_sched() is sufficient (synchronize_rcu() is probably
      sufficient, but we're not in a hurry).
      
      Kay says of this patch:
      	... no module takes more than 40 millisecs to link now, most of
      	them are between 3 and 8 millisecs.
      
      	That looks very different to the numbers without this patch
      	and the otherwise same setup, where we get heavy noise in the
      	traces and many delays of up to 200 millisecs until linking,
      	most of them taking 30+ millisecs.
      Tested-by: default avatarKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e91defa2
    • Rusty Russell's avatar
      module: include other structures in module version check · 8c8ef42a
      Rusty Russell authored
      With CONFIG_MODVERSIONS, we version 'struct module' using a dummy
      export, but other things matter too:
      
      1) 'struct modversion_info' determines the layout of the __versions section,
      2) 'struct kernel_param' determines the layout of the __params section,
      3) 'struct kernel_symbol' determines __ksymtab*.
      4) 'struct marker' determines __markers.
      5) 'struct tracepoint' determines __tracepoints.
      
      So we rename 'struct_module' to 'module_layout' and include these in
      the signature.  Now it's general we can add others later on without
      confusion.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      8c8ef42a
    • Rusty Russell's avatar
      module: remove the SHF_ALLOC flag on the __versions section. · 9cb610d8
      Rusty Russell authored
      Impact: reduce kernel memory usage
      
      This patch just takes off the SHF_ALLOC flag on __versions so we don't
      keep them around after module load.
      
      This saves about 7% of module memory if CONFIG_MODVERSIONS=y.
      
      Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      9cb610d8
    • Rusty Russell's avatar
      module: clarify the force-loading taint message. · c6e665c8
      Rusty Russell authored
      Impact: Message cleanup
      
      Two of three callers of try_to_force_load() are not because of a
      missing version, so change the messages:
      
      Old:
      	<modname>: no version for "magic" found: kernel tainted.
      New:
      	<modname>: bad vermagic: kernel tainted.
      
      Old:
      	<modname>: no version for "nocrc" found: kernel tainted.
      New:
      	<modname>: no versions for exported symbols: kernel tainted.
      
      Old:
      	<modname>: no version for "<symname>" found: kernel tainted.
      New:
      	<modname>: <symname>: kernel tainted.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c6e665c8
    • Tim Abbott's avatar
      module: Export symbols needed for Ksplice · c6b37801
      Tim Abbott authored
      Impact: Expose some module.c symbols
      
      Ksplice uses several functions from module.c in order to resolve
      symbols and implement dependency handling.  Calling these functions
      requires holding module_mutex, so it is exported.
      
      (This is just the module part of a bigger add-exports patch from Tim).
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Signed-off-by: default avatarTim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c6b37801
    • Anders Kaseorg's avatar
      Ksplice: Add functions for walking kallsyms symbols · 75a66614
      Anders Kaseorg authored
      Impact: New API
      
      kallsyms_lookup_name only returns the first match that it finds.  Ksplice
      needs information about all symbols with a given name in order to correctly
      resolve local symbols.
      
      kallsyms_on_each_symbol provides a generic mechanism for iterating over the
      kallsyms table.
      
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Cc: Tim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarAnders Kaseorg <andersk@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      75a66614
    • Rusty Russell's avatar
      module: remove module_text_address() · a6e6abd5
      Rusty Russell authored
      Impact: Replace and remove risky (non-EXPORTed) API
      
      module_text_address() returns a pointer to the module, which given locking
      improvements in module.c, is useless except to test for NULL:
      
      1) If the module can't go away, use __module_text_address.
      2) Otherwise, just use is_module_text_address().
      
      Cc: linux-mtd@lists.infradead.org
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      a6e6abd5
    • Rusty Russell's avatar
      module: __module_address · e610499e
      Rusty Russell authored
      Impact: New API, cleanup
      
      ksplice wants to know the bounds of a module, not just the module text.
      
      It makes sense to have __module_address.  We then implement
      is_module_address and __module_text_address in terms of this (and
      change is_module_text_address() to bool while we're at it).
      
      Also, add proper kerneldoc for them all.
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Cc: Tim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e610499e
    • Tim Abbott's avatar
      module: Make find_symbol return a struct kernel_symbol · 414fd31b
      Tim Abbott authored
      Impact: Cleanup, internal API change
      
      Ksplice needs access to the kernel_symbol structure in order to support
      modifications to the exported symbol table.
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Signed-off-by: default avatarTim Abbott <tabbott@mit.edu>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (bugfix and style)
      414fd31b
    • Américo Wang's avatar
      kernel/module.c: fix an unused goto label · b10153fe
      Américo Wang authored
      Impact: cleanup
      
      Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) &&
      defined(CONFIG_SMP), so move it inside to shut up gcc.
      Signed-off-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      b10153fe
    • Rusty Russell's avatar
      param: fix charp parameters set via sysfs · e180a6b7
      Rusty Russell authored
      Impact: fix crash on reading from /sys/module/.../ieee80211_default_rc_algo
      
      The module_param type "charp" simply sets a char * pointer in the
      module to the parameter in the commandline string: this is why we keep
      the (mangled) module command line around.  But when set via sysfs (as
      about 11 charp parameters can be) this memory is freed on the way
      out of the write().  Future reads hit random mem.
      
      So we kstrdup instead: we have to check we're not in early commandline
      parsing, and we have to note when we've used it so we can reliably
      kfree the parameter when it's next overwritten, and also on module
      unload.
      
      (Thanks to Randy Dunlap for CONFIG_SYSFS=n fixes)
      Reported-by: default avatarSitsofe Wheeler <sitsofe@yahoo.com>
      Diagnosed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Tested-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Tested-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e180a6b7
  18. 24 Mar, 2009 1 commit
    • Jason Baron's avatar
      dynamic debug: combine dprintk and dynamic printk · e9d376f0
      Jason Baron authored
      This patch combines Greg Bank's dprintk() work with the existing dynamic
      printk patchset, we are now calling it 'dynamic debug'.
      
      The new feature of this patchset is a richer /debugfs control file interface,
      (an example output from my system is at the bottom), which allows fined grained
      control over the the debug output. The output can be controlled by function,
      file, module, format string, and line number.
      
      for example, enabled all debug messages in module 'nf_conntrack':
      
      echo -n 'module nf_conntrack +p' > /mnt/debugfs/dynamic_debug/control
      
      to disable them:
      
      echo -n 'module nf_conntrack -p' > /mnt/debugfs/dynamic_debug/control
      
      A further explanation can be found in the documentation patch.
      Signed-off-by: default avatarGreg Banks <gnb@sgi.com>
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e9d376f0
  19. 17 Mar, 2009 1 commit
  20. 06 Mar, 2009 2 commits
  21. 05 Mar, 2009 1 commit
    • Tejun Heo's avatar
      percpu, module: implement reserved allocation and use it for module percpu variables · edcb4639
      Tejun Heo authored
      Impact: add reserved allocation functionality and use it for module
      	percpu variables
      
      This patch implements reserved allocation from the first chunk.  When
      setting up the first chunk, arch can ask to set aside certain number
      of bytes right after the core static area which is available only
      through a separate reserved allocator.  This will be used primarily
      for module static percpu variables on architectures with limited
      relocation range to ensure that the module perpcu symbols are inside
      the relocatable range.
      
      If reserved area is requested, the first chunk becomes reserved and
      isn't available for regular allocation.  If the first chunk also
      includes piggy-back dynamic allocation area, a separate chunk mapping
      the same region is created to serve dynamic allocation.  The first one
      is called static first chunk and the second dynamic first chunk.
      Although they share the page map, their different area map
      initializations guarantee they serve disjoint areas according to their
      purposes.
      
      If arch doesn't setup reserved area, reserved allocation is handled
      like any other allocation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      edcb4639
  22. 20 Feb, 2009 2 commits
    • Tejun Heo's avatar
      percpu: implement new dynamic percpu allocator · fbf59bc9
      Tejun Heo authored
      Impact: new scalable dynamic percpu allocator which allows dynamic
              percpu areas to be accessed the same way as static ones
      
      Implement scalable dynamic percpu allocator which can be used for both
      static and dynamic percpu areas.  This will allow static and dynamic
      areas to share faster direct access methods.  This feature is optional
      and enabled only when CONFIG_HAVE_DYNAMIC_PER_CPU_AREA is defined by
      arch.  Please read comment on top of mm/percpu.c for details.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      fbf59bc9
    • Tejun Heo's avatar
      module: reorder module pcpu related functions · 6b588c18
      Tejun Heo authored
      Impact: cleanup
      
      Move percpu_modinit() upwards.  This is to ease further changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      6b588c18
  23. 09 Feb, 2009 1 commit
  24. 02 Feb, 2009 1 commit
    • Eric Dumazet's avatar
      modules: Use a better scheme for refcounting · 720eba31
      Eric Dumazet authored
      Current refcounting for modules (done if CONFIG_MODULE_UNLOAD=y) is
      using a lot of memory.
      
      Each 'struct module' contains an [NR_CPUS] array of full cache lines.
      
      This patch uses existing infrastructure (percpu_modalloc() &
      percpu_modfree()) to allocate percpu space for the refcount storage.
      
      Instead of wasting NR_CPUS*128 bytes (on i386), we now use
      nr_cpu_ids*sizeof(local_t) bytes.
      
      On a typical distro, where NR_CPUS=8, shiping 2000 modules, we reduce
      size of module files by about 2 Mbytes. (1Kb per module)
      
      Instead of having all refcounters in the same memory node - with TLB misses
      because of vmalloc() - this new implementation permits to have better
      NUMA properties, since each  CPU will use storage on its preferred node,
      thanks to percpu storage.
      Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      720eba31
  25. 14 Jan, 2009 1 commit