Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH 1/4] test: test for the proper pointer
@ 2012-10-13 16:08 Lai Jiangshan
  2012-10-13 16:08 ` [lttng-dev] [PATCH 2/4] test: remove rcu_defer_register_thread() from test_urcu_lfs Lai Jiangshan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Lai Jiangshan @ 2012-10-13 16:08 UTC (permalink / raw)


We should use "if (snode)" instead of "if (node)" in case of
the struct cds_lfs_node_rcu is not the first field of struct node.

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
 tests/test_urcu_lfs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c
index 88bf65d..681b654 100644
--- a/tests/test_urcu_lfs.c
+++ b/tests/test_urcu_lfs.c
@@ -242,13 +242,14 @@ void *thr_dequeuer(void *_count)
 
 	for (;;) {
 		struct cds_lfs_node_rcu *snode;
-		struct test *node;
 
 		rcu_read_lock();
 		snode = cds_lfs_pop_rcu(&s);
-		node = caa_container_of(snode, struct test, list);
 		rcu_read_unlock();
-		if (node) {
+		if (snode) {
+			struct test *node;
+
+			node = caa_container_of(snode, struct test, list);
 			call_rcu(&node->rcu, free_node_cb);
 			URCU_TLS(nr_successful_dequeues)++;
 		}
-- 
1.7.7.6




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-13 16:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13 16:08 [lttng-dev] [PATCH 1/4] test: test for the proper pointer Lai Jiangshan
2012-10-13 16:08 ` [lttng-dev] [PATCH 2/4] test: remove rcu_defer_register_thread() from test_urcu_lfs Lai Jiangshan
2012-10-13 16:46   ` Mathieu Desnoyers
2012-10-13 16:08 ` [lttng-dev] [PATCH 3/4] test: test for the proper pointer Lai Jiangshan
2012-10-13 16:48   ` Mathieu Desnoyers
2012-10-13 16:08 ` [lttng-dev] [PATCH 4/4] test: remove rcu_defer_register_thread() from test_urcu_lfq Lai Jiangshan
2012-10-13 16:49   ` Mathieu Desnoyers
2012-10-13 16:44 ` [lttng-dev] [PATCH 1/4] test: test for the proper pointer Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox