- per-cpufy-net-proto-structures-add-percpu_counter_modbh.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     ] per-cpufy-net-proto structures: Add percpu_counter_modbh

has been removed from the -mm tree.  Its filename is

     per-cpufy-net-proto-structures-add-percpu_counter_modbh.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.

------------------------------------------------------
Subject: ] per-cpufy-net-proto structures: Add percpu_counter_modbh
From: Ravikiran G Thirumalai <kiran@xxxxxxxxxxxx>


Add percpu_counter_mod_bh for using these counters safely from both softirq
and process context.

Signed-off-by: Pravin B. Shelar <pravins@xxxxxxxxxxxxxx>
Signed-off-by: Ravikiran G Thirumalai <kiran@xxxxxxxxxxxx>
Signed-off-by: Shai Fultheim <shai@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/percpu_counter.h |    9 +++++++++
 mm/swap.c                      |   20 +++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff -puN include/linux/percpu_counter.h~per-cpufy-net-proto-structures-add-percpu_counter_modbh include/linux/percpu_counter.h
--- devel/include/linux/percpu_counter.h~per-cpufy-net-proto-structures-add-percpu_counter_modbh	2006-05-11 15:18:51.000000000 -0700
+++ devel-akpm/include/linux/percpu_counter.h	2006-05-11 15:18:51.000000000 -0700
@@ -10,6 +10,7 @@
 #include <linux/smp.h>
 #include <linux/threads.h>
 #include <linux/percpu.h>
+#include <linux/interrupt.h>
 
 #ifdef CONFIG_SMP
 
@@ -39,6 +40,7 @@ static inline void percpu_counter_destro
 
 void percpu_counter_mod(struct percpu_counter *fbc, long amount);
 long percpu_counter_sum(struct percpu_counter *fbc);
+void percpu_counter_mod_bh(struct percpu_counter *fbc, long amount);
 
 static inline long percpu_counter_read(struct percpu_counter *fbc)
 {
@@ -97,6 +99,12 @@ static inline long percpu_counter_sum(st
 	return percpu_counter_read_positive(fbc);
 }
 
+static inline void percpu_counter_mod_bh(struct percpu_counter *fbc, long amount)
+{
+	local_bh_disable();
+	fbc->count += amount;
+	local_bh_enable();
+}
 #endif	/* CONFIG_SMP */
 
 static inline void percpu_counter_inc(struct percpu_counter *fbc)
@@ -109,4 +117,5 @@ static inline void percpu_counter_dec(st
 	percpu_counter_mod(fbc, -1);
 }
 
+
 #endif /* _LINUX_PERCPU_COUNTER_H */
diff -puN mm/swap.c~per-cpufy-net-proto-structures-add-percpu_counter_modbh mm/swap.c
--- devel/mm/swap.c~per-cpufy-net-proto-structures-add-percpu_counter_modbh	2006-05-11 15:18:51.000000000 -0700
+++ devel-akpm/mm/swap.c	2006-05-11 15:18:51.000000000 -0700
@@ -481,11 +481,11 @@ static int cpu_swap_callback(struct noti
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_SMP
-void percpu_counter_mod(struct percpu_counter *fbc, long amount)
+static void __percpu_counter_mod(struct percpu_counter *fbc, long amount)
 {
 	long count;
 	long *pcount;
-	int cpu = get_cpu();
+	int cpu = smp_processor_id();
 
 	pcount = per_cpu_ptr(fbc->counters, cpu);
 	count = *pcount + amount;
@@ -497,10 +497,24 @@ void percpu_counter_mod(struct percpu_co
 	} else {
 		*pcount = count;
 	}
-	put_cpu();
+}
+
+void percpu_counter_mod(struct percpu_counter *fbc, long amount)
+{
+	preempt_disable();
+	__percpu_counter_mod(fbc, amount);
+	preempt_enable();
 }
 EXPORT_SYMBOL(percpu_counter_mod);
 
+void percpu_counter_mod_bh(struct percpu_counter *fbc, long amount)
+{
+	local_bh_disable();
+	__percpu_counter_mod(fbc, amount);
+	local_bh_enable();
+}
+EXPORT_SYMBOL(percpu_counter_mod_bh);
+
 /*
  * Add up all the per-cpu counts, return the result.  This is a more accurate
  * but much slower version of percpu_counter_read_positive()
_

Patches currently in -mm which might be from kiran@xxxxxxxxxxxx are

avoid-tasklist_lock-at-getrusage-for-multithreaded-case-too.patch
percpu-counters-add-percpu_counter_exceeds.patch
slab-leaks3-default-y.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux