diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcu/srcu.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/rcu/srcu.c b/kernel/rcu/srcu.c index d2c8dcefdbdb..bfea8caf8fe2 100644 --- a/kernel/rcu/srcu.c +++ b/kernel/rcu/srcu.c @@ -289,17 +289,20 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); /* * Counts the new reader in the appropriate per-CPU element of the - * srcu_struct. Must be called from process context. + * srcu_struct. * Returns an index that must be passed to the matching srcu_read_unlock(). */ int __srcu_read_lock(struct srcu_struct *sp) { + unsigned long flags; int idx; idx = ACCESS_ONCE(sp->completed) & 0x1; - ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) += 1; + raw_local_irq_save(flags); + ACCESS_ONCE(raw_cpu_ptr(sp->per_cpu_ref)->c[idx]) += 1; smp_mb(); /* B */ /* Avoid leaking the critical section. */ - ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->seq[idx]) += 1; + ACCESS_ONCE(raw_cpu_ptr(sp->per_cpu_ref)->seq[idx]) += 1; + raw_local_irq_restore(flags); return idx; } EXPORT_SYMBOL_GPL(__srcu_read_lock); @@ -308,7 +311,6 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); * Removes the count for the old reader from the appropriate per-CPU * element of the srcu_struct. Note that this may well be a different * CPU than that which was incremented by the corresponding srcu_read_lock(). - * Must be called from process context. */ void __srcu_read_unlock(struct srcu_struct *sp, int idx) { |
