]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix percpu_counter_mod linkage problem
authorAndrew Morton <akpm@osdl.org>
Tue, 18 Nov 2003 16:15:35 +0000 (08:15 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 18 Nov 2003 16:15:35 +0000 (08:15 -0800)
If both ext2 and ext3 are built as modules there is nothing to pull
percpu_counter_mod() into the kernel build and the ext2 and ext3 modules do
not load.

So move percpu_counter_mod() out of lib.a.

lib/Makefile
lib/percpu_counter.c [deleted file]
mm/swap.c

index 3ba542f64d6d3d913a286f0f878529028b3311e5..3bc9013c4b97388341176d75feb7abe6f03606f0 100644 (file)
@@ -9,7 +9,6 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
 
 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 --git a/lib/percpu_counter.c b/lib/percpu_counter.c
deleted file mode 100644 (file)
index 2c5c7b5..0000000
+++ /dev/null
@@ -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);
index c519c8959eb5ef85cea05790df148ab2572eea09..6c86da966209e9dc6718cf9d41cd6a8d18c0e26b 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -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