projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
041b78f
)
percpu_counter: use this_cpu_ptr() instead of per_cpu_ptr()
author
Christoph Lameter
<
[email protected]
>
Tue, 26 Oct 2010 21:23:09 +0000
(14:23 -0700)
committer
Linus Torvalds
<
[email protected]
>
Tue, 26 Oct 2010 23:52:19 +0000
(16:52 -0700)
this_cpu_ptr() avoids an array lookup and can use the percpu offset of the
local cpu directly.
Signed-off-by: Christoph Lameter <
[email protected]
>
Cc: Eric Dumazet <
[email protected]
>
Cc: Tejun Heo <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
lib/percpu_counter.c
patch
|
blob
|
history
diff --git
a/lib/percpu_counter.c
b/lib/percpu_counter.c
index 1d954ea72331499326b14c9564b4f90f64defec7..604678d7d06d9b101feafb31da72654d5f618500 100644
(file)
--- a/
lib/percpu_counter.c
+++ b/
lib/percpu_counter.c
@@
-73,9
+73,9
@@
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
{
s64 count;
s32 *pcount;
- int cpu = get_cpu();
- pcount = per_cpu_ptr(fbc->counters, cpu);
+ preempt_disable();
+ pcount = this_cpu_ptr(fbc->counters);
count = *pcount + amount;
if (count >= batch || count <= -batch) {
spin_lock(&fbc->lock);
@@
-85,7
+85,7
@@
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
} else {
*pcount = count;
}
- p
ut_cpu
();
+ p
reempt_enable
();
}
EXPORT_SYMBOL(__percpu_counter_add);