|
|
| File: [Development] / linux-2.6-xfs-OLD / linux / lib / percpu_counter.c (download)
Revision 1.3, Thu Oct 9 17:58:06 2003 UTC (14 years ago) by lord
merge up to 2.6.0-test7 |
#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);