[PATCH 1/8] srcu: simplify __srcu_read_unlock() via this_cpu_dec()

From: Lai Jiangshan
Date: Thu Nov 29 2012 - 03:42:54 EST


this_cpu_dec() can do the same thing and sometimes it is better.
(avoid preempt_disable() and use more tiny instructions)

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
kernel/srcu.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/kernel/srcu.c b/kernel/srcu.c
index b363b09..b2e4f36 100644
--- a/kernel/srcu.c
+++ b/kernel/srcu.c
@@ -317,10 +317,8 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock);
*/
void __srcu_read_unlock(struct srcu_struct *sp, int idx)
{
- preempt_disable();
smp_mb(); /* C */ /* Avoid leaking the critical section. */
- ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) -= 1;
- preempt_enable();
+ this_cpu_dec(sp->per_cpu_ref->c[idx]);
}
EXPORT_SYMBOL_GPL(__srcu_read_unlock);

--
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/