diff options
author | Josh Triplett <josh@freedesktop.org> | 2008-01-29 00:58:15 -0800 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2008-01-29 00:58:15 -0800 |
commit | 8647e0fb77a411edbe260fca8bab7f7d4d3d7655 (patch) | |
tree | 4d5a346255540a982b0ea4eec891bec17c13d6a7 | |
parent | b20ca38450e7d783ead31e24588f0bd7e47e8aa9 (diff) | |
download | rcuhashbash-8647e0fb77a411edbe260fca8bab7f7d4d3d7655.tar.gz |
Add new nosync_rcu_dereference variant
-rw-r--r-- | rcuhashbash.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/rcuhashbash.c b/rcuhashbash.c index 19d3865..c77bcd1 100644 --- a/rcuhashbash.c +++ b/rcuhashbash.c @@ -154,6 +154,37 @@ static int rcuhashbash_reader_nosync(void *arg) return 0; } +static int rcuhashbash_reader_nosync_rcu_dereference(void *arg) +{ + struct reader_stats *stats_ret = arg; + struct reader_stats stats = { 0 }; + DEFINE_RCU_RANDOM(rand); + + set_user_nice(current, 19); + + do { + struct rcuhashbash_entry *entry; + struct hlist_node *node; + u32 value; + + cond_resched(); + + value = rcu_random(&rand) % (entries * 2); + + hlist_for_each_entry_rcu(entry, node, &hash_table[value % buckets].head, node) + if (entry->value == value) + break; + if (node) + stats.hits++; + else + stats.misses++; + } while (!kthread_should_stop()); + + *stats_ret = stats; + + return 0; +} + static int rcuhashbash_reader_rcu(void *arg) { struct reader_stats *stats_ret = arg; @@ -609,6 +640,14 @@ static struct rcuhashbash_ops all_ops[] = { .max_writers = 0, }, { + .reader_type = "nosync_rcu_dereference", + .writer_type = "none", + .reader_thread = rcuhashbash_reader_nosync_rcu_dereference, + .writer_thread = NULL, + .limit_writers = true, + .max_writers = 0, + }, + { .reader_type = "rcu", .writer_type = "single", .reader_thread = rcuhashbash_reader_rcu, |