Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302758
b: refs/heads/master
c: 440253c
h: refs/heads/master
v: v3
  • Loading branch information
Lai Jiangshan authored and Paul E. McKenney committed Apr 30, 2012
1 parent d3b4553 commit 2b29d2f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b7a3e9e32114a09c61995048f055615b5d4c26d
refs/heads/master: 440253c17fc4ed41d778492a7fb44dc0d756eccc
2 changes: 1 addition & 1 deletion trunk/include/linux/srcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct srcu_struct_array {
};

/* Bit definitions for field ->c above and ->snap below. */
#define SRCU_USAGE_BITS 2
#define SRCU_USAGE_BITS 1
#define SRCU_REF_MASK (ULONG_MAX >> SRCU_USAGE_BITS)
#define SRCU_USAGE_COUNT (SRCU_REF_MASK + 1)

Expand Down
19 changes: 9 additions & 10 deletions trunk/kernel/srcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ static bool srcu_readers_active_idx_check(struct srcu_struct *sp, int idx)

/*
* Now, we check the ->snap array that srcu_readers_active_idx()
* filled in from the per-CPU counter values. Since both
* __srcu_read_lock() and __srcu_read_unlock() increment the
* upper bits of the per-CPU counter, an increment/decrement
* pair will change the value of the counter. Since there is
* only one possible increment, the only way to wrap the counter
* is to have a huge number of counter decrements, which requires
* a huge number of tasks and huge SRCU read-side critical-section
* nesting levels, even on 32-bit systems.
* filled in from the per-CPU counter values. Since
* __srcu_read_lock() increments the upper bits of the per-CPU
* counter, an increment/decrement pair will change the value
* of the counter. Since there is only one possible increment,
* the only way to wrap the counter is to have a huge number of
* counter decrements, which requires a huge number of tasks and
* huge SRCU read-side critical-section nesting levels, even on
* 32-bit systems.
*
* All of the ways of confusing the readings require that the scan
* in srcu_readers_active_idx() see the read-side task's decrement,
Expand Down Expand Up @@ -234,8 +234,7 @@ 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]) +=
SRCU_USAGE_COUNT - 1;
ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) -= 1;
preempt_enable();
}
EXPORT_SYMBOL_GPL(__srcu_read_unlock);
Expand Down

0 comments on commit 2b29d2f

Please sign in to comment.