Re: percpu_counter_mod not getting into SMP kernel image when ext2/3 compiled as modules

From: Andrew Morton (akpm_at_osdl.org)
Date: 11/11/03

  • Next message: Gerardo Exequiel Pozzi: "Re: [2.6.0-test9-mm2] Badness in as_put_request at drivers/block/as-iosched.c:1783"
    Date:	Mon, 10 Nov 2003 16:40:30 -0800
    To: Jeff Bowden <jlb@houseofdistraction.com>
    
    

    Jeff Bowden <jlb@houseofdistraction.com> wrote:
    >
    > In 2.6.9-test9 (also tried with bk15) I have ext2 and ext3 both
    > configured as modules. When I do "modprobe ext3" it says:
    >
    > FATAL: Error inserting ext3
    > (/lib/modules/2.6.0-test9-bug-t1/kernel/fs/ext3/ext3.ko): Unknown symbol
    > in module, or unknown parameter (see dmesg)
    >
    > and dmesg says:
    >
    > ext3: Unknown symbol percpu_counter_mod

    You'll be needing this:

    diff -puN -L lib/percpu_counter.c lib/percpu_counter.c~percpu-counter-linkage-fix /dev/null
    --- 25/lib/percpu_counter.c
    +++ /dev/null 2002-08-30 16:31:37.000000000 -0700
    @@ -1,21 +0,0 @@
    -#include <linux/module.h>
    -#include <linux/percpu_counter.h>
    -#include <linux/sched.h>
    -
    -void percpu_counter_mod(struct percpu_counter *fbc, long amount)
    -{
    - int cpu = get_cpu();
    - long count = fbc->counters[cpu].count;
    -
    - count += amount;
    - if (count >= FBC_BATCH || count <= -FBC_BATCH) {
    - spin_lock(&fbc->lock);
    - fbc->count += count;
    - spin_unlock(&fbc->lock);
    - count = 0;
    - }
    - fbc->counters[cpu].count = count;
    - put_cpu();
    -}
    -
    -EXPORT_SYMBOL(percpu_counter_mod);
    diff -puN lib/Makefile~percpu-counter-linkage-fix lib/Makefile
    --- 25/lib/Makefile~percpu-counter-linkage-fix 2003-11-07 20:36:48.000000000 -0800
    +++ 25-akpm/lib/Makefile 2003-11-07 20:36:48.000000000 -0800
    @@ -9,7 +9,6 @@ lib-y := errno.o ctype.o string.o vsprin
     
     lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
     lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
    -lib-$(CONFIG_SMP) += percpu_counter.o
     
     ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
       lib-y += dec_and_lock.o
    diff -puN mm/swap.c~percpu-counter-linkage-fix mm/swap.c
    --- 25/mm/swap.c~percpu-counter-linkage-fix 2003-11-07 20:36:48.000000000 -0800
    +++ 25-akpm/mm/swap.c 2003-11-07 20:36:48.000000000 -0800
    @@ -14,6 +14,7 @@
      */
     
     #include <linux/mm.h>
    +#include <linux/sched.h>
     #include <linux/kernel_stat.h>
     #include <linux/swap.h>
     #include <linux/mman.h>
    @@ -23,6 +24,8 @@
     #include <linux/module.h>
     #include <linux/mm_inline.h>
     #include <linux/buffer_head.h> /* for try_to_release_page() */
    +#include <linux/module.h>
    +#include <linux/percpu_counter.h>
     #include <linux/percpu.h>
     
     /* How many pages do we try to swap or page in/out together? */
    @@ -380,6 +383,24 @@ void vm_acct_memory(long pages)
     EXPORT_SYMBOL(vm_acct_memory);
     #endif
     
    +#ifdef CONFIG_SMP
    +void percpu_counter_mod(struct percpu_counter *fbc, long amount)
    +{
    + int cpu = get_cpu();
    + long count = fbc->counters[cpu].count;
    +
    + count += amount;
    + if (count >= FBC_BATCH || count <= -FBC_BATCH) {
    + spin_lock(&fbc->lock);
    + fbc->count += count;
    + spin_unlock(&fbc->lock);
    + count = 0;
    + }
    + fbc->counters[cpu].count = count;
    + put_cpu();
    +}
    +EXPORT_SYMBOL(percpu_counter_mod);
    +#endif
     
     /*
      * Perform any setup for the swap system

    _

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Gerardo Exequiel Pozzi: "Re: [2.6.0-test9-mm2] Badness in as_put_request at drivers/block/as-iosched.c:1783"

    Relevant Pages

    • Re: lib.a causing modules not to load
      ... -void percpu_counter_mod(struct percpu_counter *fbc, long amount) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: hello world module
      ... bash-2.05b# dmesg | tail -n1 ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [RFC] restricted overcommit
      ... Below a trimmed down version of a patch I made a few days ago. ... giving a guaranteed lower bound on the amount of stack available. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • enabling IOAPIC on C3 processor?
      ... APIC options are 'y'. ... dmesg | grep APIC tells me "no local APIC present or hardware disabled". ... adding lapic kernel parameter doesn't change that. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: RFC: [2.6 patch] let BLK_DEV_UB depend on EMBEDDED
      ... I could not imagine users can be so dumb. ... Often times they cut the dmesg so we can't ... And this usually takes 3 days for the entire exchange. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)