More cleaning ...
[linux-2.6/linux-mips.git] / lib / percpu_counter.c
bloba9afaec00bdd830d8c90b59177450847fa76662d
2 #include <linux/percpu_counter.h>
3 #include <linux/sched.h>
5 void percpu_counter_mod(struct percpu_counter *fbc, long amount)
7 int cpu = get_cpu();
8 long count = fbc->counters[cpu].count;
10 count += amount;
11 if (count >= FBC_BATCH || count <= -FBC_BATCH) {
12 spin_lock(&fbc->lock);
13 fbc->count += count;
14 spin_unlock(&fbc->lock);
15 count = 0;
17 fbc->counters[cpu].count = count;
18 put_cpu();