Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38452
b: refs/heads/master
c: e303373
h: refs/heads/master
v: v3
  • Loading branch information
Josh Triplett authored and Linus Torvalds committed Oct 4, 2006
1 parent c270ac5 commit 3869505
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 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: b772e1dd4b1e60a7a160f7bd4ea08e28394ceb54
refs/heads/master: e3033736581f125ba5fd6c0760e0d430d54fb5c0
53 changes: 29 additions & 24 deletions trunk/kernel/rcutorture.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ static atomic_t n_rcu_torture_alloc_fail;
static atomic_t n_rcu_torture_free;
static atomic_t n_rcu_torture_mberror;
static atomic_t n_rcu_torture_error;
static struct list_head rcu_torture_removed;

/*
* Allocate an element from the rcu_tortures pool.
Expand Down Expand Up @@ -270,6 +271,32 @@ static struct rcu_torture_ops rcu_ops = {
.name = "rcu"
};

static void rcu_sync_torture_deferred_free(struct rcu_torture *p)
{
int i;
struct rcu_torture *rp;
struct rcu_torture *rp1;

cur_ops->sync();
list_add(&p->rtort_free, &rcu_torture_removed);
list_for_each_entry_safe(rp, rp1, &rcu_torture_removed, rtort_free) {
i = rp->rtort_pipe_count;
if (i > RCU_TORTURE_PIPE_LEN)
i = RCU_TORTURE_PIPE_LEN;
atomic_inc(&rcu_torture_wcount[i]);
if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
rp->rtort_mbtest = 0;
list_del(&rp->rtort_free);
rcu_torture_free(rp);
}
}
}

static void rcu_sync_torture_init(void)
{
INIT_LIST_HEAD(&rcu_torture_removed);
}

/*
* Definitions for rcu_bh torture testing.
*/
Expand Down Expand Up @@ -335,12 +362,11 @@ static struct rcu_torture_ops rcu_bh_ops = {
*/

static struct srcu_struct srcu_ctl;
static struct list_head srcu_removed;

static void srcu_torture_init(void)
{
init_srcu_struct(&srcu_ctl);
INIT_LIST_HEAD(&srcu_removed);
rcu_sync_torture_init();
}

static void srcu_torture_cleanup(void)
Expand Down Expand Up @@ -377,27 +403,6 @@ static int srcu_torture_completed(void)
return srcu_batches_completed(&srcu_ctl);
}

static void srcu_torture_deferred_free(struct rcu_torture *p)
{
int i;
struct rcu_torture *rp;
struct rcu_torture *rp1;

synchronize_srcu(&srcu_ctl);
list_add(&p->rtort_free, &srcu_removed);
list_for_each_entry_safe(rp, rp1, &srcu_removed, rtort_free) {
i = rp->rtort_pipe_count;
if (i > RCU_TORTURE_PIPE_LEN)
i = RCU_TORTURE_PIPE_LEN;
atomic_inc(&rcu_torture_wcount[i]);
if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
rp->rtort_mbtest = 0;
list_del(&rp->rtort_free);
rcu_torture_free(rp);
}
}
}

static void srcu_torture_synchronize(void)
{
synchronize_srcu(&srcu_ctl);
Expand Down Expand Up @@ -427,7 +432,7 @@ static struct rcu_torture_ops srcu_ops = {
.readdelay = srcu_read_delay,
.readunlock = srcu_torture_read_unlock,
.completed = srcu_torture_completed,
.deferredfree = srcu_torture_deferred_free,
.deferredfree = rcu_sync_torture_deferred_free,
.sync = srcu_torture_synchronize,
.stats = srcu_torture_stats,
.name = "srcu"
Expand Down

0 comments on commit 3869505

Please sign in to comment.