* [lttng-dev] [PATCH 2/4] test: remove rcu_defer_register_thread() from test_urcu_lfs
2012-10-13 16:08 [lttng-dev] [PATCH 1/4] test: test for the proper pointer Lai Jiangshan
@ 2012-10-13 16:08 ` 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
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Lai Jiangshan @ 2012-10-13 16:08 UTC (permalink / raw)
test_urcu_lfs has already switch to call_rcu(), rcu_defer_register_thread()
is unneeded.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
tests/test_urcu_lfs.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c
index 681b654..f5d7d4b 100644
--- a/tests/test_urcu_lfs.c
+++ b/tests/test_urcu_lfs.c
@@ -67,7 +67,6 @@ static inline pid_t gettid(void)
#endif
#include <urcu.h>
#include <urcu/cds.h>
-#include <urcu-defer.h>
static volatile int test_go, test_stop;
@@ -221,18 +220,12 @@ void free_node_cb(struct rcu_head *head)
void *thr_dequeuer(void *_count)
{
unsigned long long *count = _count;
- int ret;
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"dequeuer", pthread_self(), (unsigned long)gettid());
set_affinity();
- ret = rcu_defer_register_thread();
- if (ret) {
- printf("Error in rcu_defer_register_thread\n");
- exit(-1);
- }
rcu_register_thread();
while (!test_go)
@@ -261,7 +254,6 @@ void *thr_dequeuer(void *_count)
}
rcu_unregister_thread();
- rcu_defer_unregister_thread();
printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
"dequeues %llu, successful_dequeues %llu\n",
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread* [lttng-dev] [PATCH 2/4] test: remove rcu_defer_register_thread() from test_urcu_lfs
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
0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2012-10-13 16:46 UTC (permalink / raw)
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> test_urcu_lfs has already switch to call_rcu(), rcu_defer_register_thread()
> is unneeded.
Merged, thanks!
Mathieu
>
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
> tests/test_urcu_lfs.c | 8 --------
> 1 files changed, 0 insertions(+), 8 deletions(-)
>
> diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c
> index 681b654..f5d7d4b 100644
> --- a/tests/test_urcu_lfs.c
> +++ b/tests/test_urcu_lfs.c
> @@ -67,7 +67,6 @@ static inline pid_t gettid(void)
> #endif
> #include <urcu.h>
> #include <urcu/cds.h>
> -#include <urcu-defer.h>
>
> static volatile int test_go, test_stop;
>
> @@ -221,18 +220,12 @@ void free_node_cb(struct rcu_head *head)
> void *thr_dequeuer(void *_count)
> {
> unsigned long long *count = _count;
> - int ret;
>
> printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
> "dequeuer", pthread_self(), (unsigned long)gettid());
>
> set_affinity();
>
> - ret = rcu_defer_register_thread();
> - if (ret) {
> - printf("Error in rcu_defer_register_thread\n");
> - exit(-1);
> - }
> rcu_register_thread();
>
> while (!test_go)
> @@ -261,7 +254,6 @@ void *thr_dequeuer(void *_count)
> }
>
> rcu_unregister_thread();
> - rcu_defer_unregister_thread();
>
> printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
> "dequeues %llu, successful_dequeues %llu\n",
> --
> 1.7.7.6
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [lttng-dev] [PATCH 3/4] test: test for the proper pointer
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:08 ` 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:44 ` [lttng-dev] [PATCH 1/4] test: test for the proper pointer Mathieu Desnoyers
3 siblings, 1 reply; 8+ messages in thread
From: Lai Jiangshan @ 2012-10-13 16:08 UTC (permalink / raw)
We should use "if (qnode)" instead of "if (node)" in case of
the struct cds_lfq_node_rcu is not the first field of struct node.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
tests/test_urcu_lfq.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/test_urcu_lfq.c b/tests/test_urcu_lfq.c
index 66ddd41..0fcbf55 100644
--- a/tests/test_urcu_lfq.c
+++ b/tests/test_urcu_lfq.c
@@ -243,14 +243,15 @@ void *thr_dequeuer(void *_count)
for (;;) {
struct cds_lfq_node_rcu *qnode;
- struct test *node;
rcu_read_lock();
qnode = cds_lfq_dequeue_rcu(&q);
- node = caa_container_of(qnode, struct test, list);
rcu_read_unlock();
- if (node) {
+ if (qnode) {
+ struct test *node;
+
+ node = caa_container_of(qnode, 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* [lttng-dev] [PATCH 3/4] test: test for the proper pointer
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
0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2012-10-13 16:48 UTC (permalink / raw)
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> We should use "if (qnode)" instead of "if (node)" in case of
> the struct cds_lfq_node_rcu is not the first field of struct node.
merged, thanks!
Mathieu
>
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
> tests/test_urcu_lfq.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tests/test_urcu_lfq.c b/tests/test_urcu_lfq.c
> index 66ddd41..0fcbf55 100644
> --- a/tests/test_urcu_lfq.c
> +++ b/tests/test_urcu_lfq.c
> @@ -243,14 +243,15 @@ void *thr_dequeuer(void *_count)
>
> for (;;) {
> struct cds_lfq_node_rcu *qnode;
> - struct test *node;
>
> rcu_read_lock();
> qnode = cds_lfq_dequeue_rcu(&q);
> - node = caa_container_of(qnode, struct test, list);
> rcu_read_unlock();
>
> - if (node) {
> + if (qnode) {
> + struct test *node;
> +
> + node = caa_container_of(qnode, struct test, list);
> call_rcu(&node->rcu, free_node_cb);
> URCU_TLS(nr_successful_dequeues)++;
> }
> --
> 1.7.7.6
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [lttng-dev] [PATCH 4/4] test: remove rcu_defer_register_thread() from test_urcu_lfq
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:08 ` [lttng-dev] [PATCH 3/4] test: test for the proper pointer Lai Jiangshan
@ 2012-10-13 16:08 ` 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
3 siblings, 1 reply; 8+ messages in thread
From: Lai Jiangshan @ 2012-10-13 16:08 UTC (permalink / raw)
test_urcu_lfq has already switch to call_rcu(), rcu_defer_register_thread()
is unneeded.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
tests/test_urcu_lfq.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/tests/test_urcu_lfq.c b/tests/test_urcu_lfq.c
index 0fcbf55..1204d92 100644
--- a/tests/test_urcu_lfq.c
+++ b/tests/test_urcu_lfq.c
@@ -67,7 +67,6 @@ static inline pid_t gettid(void)
#endif
#include <urcu.h>
#include <urcu/cds.h>
-#include <urcu-defer.h>
static volatile int test_go, test_stop;
@@ -222,18 +221,12 @@ void free_node_cb(struct rcu_head *head)
void *thr_dequeuer(void *_count)
{
unsigned long long *count = _count;
- int ret;
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"dequeuer", pthread_self(), (unsigned long)gettid());
set_affinity();
- ret = rcu_defer_register_thread();
- if (ret) {
- printf("Error in rcu_defer_register_thread\n");
- exit(-1);
- }
rcu_register_thread();
while (!test_go)
@@ -264,7 +257,6 @@ void *thr_dequeuer(void *_count)
}
rcu_unregister_thread();
- rcu_defer_unregister_thread();
printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
"dequeues %llu, successful_dequeues %llu\n",
pthread_self(), (unsigned long)gettid(),
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread* [lttng-dev] [PATCH 4/4] test: remove rcu_defer_register_thread() from test_urcu_lfq
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
0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2012-10-13 16:49 UTC (permalink / raw)
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> test_urcu_lfq has already switch to call_rcu(), rcu_defer_register_thread()
> is unneeded.
merged, thanks!
Mathieu
>
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
> tests/test_urcu_lfq.c | 8 --------
> 1 files changed, 0 insertions(+), 8 deletions(-)
>
> diff --git a/tests/test_urcu_lfq.c b/tests/test_urcu_lfq.c
> index 0fcbf55..1204d92 100644
> --- a/tests/test_urcu_lfq.c
> +++ b/tests/test_urcu_lfq.c
> @@ -67,7 +67,6 @@ static inline pid_t gettid(void)
> #endif
> #include <urcu.h>
> #include <urcu/cds.h>
> -#include <urcu-defer.h>
>
> static volatile int test_go, test_stop;
>
> @@ -222,18 +221,12 @@ void free_node_cb(struct rcu_head *head)
> void *thr_dequeuer(void *_count)
> {
> unsigned long long *count = _count;
> - int ret;
>
> printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
> "dequeuer", pthread_self(), (unsigned long)gettid());
>
> set_affinity();
>
> - ret = rcu_defer_register_thread();
> - if (ret) {
> - printf("Error in rcu_defer_register_thread\n");
> - exit(-1);
> - }
> rcu_register_thread();
>
> while (!test_go)
> @@ -264,7 +257,6 @@ void *thr_dequeuer(void *_count)
> }
>
> rcu_unregister_thread();
> - rcu_defer_unregister_thread();
> printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
> "dequeues %llu, successful_dequeues %llu\n",
> pthread_self(), (unsigned long)gettid(),
> --
> 1.7.7.6
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [lttng-dev] [PATCH 1/4] test: test for the proper pointer
2012-10-13 16:08 [lttng-dev] [PATCH 1/4] test: test for the proper pointer Lai Jiangshan
` (2 preceding siblings ...)
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:44 ` Mathieu Desnoyers
3 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2012-10-13 16:44 UTC (permalink / raw)
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> 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>
merged, thanks!
Mathieu
> ---
> 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
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 8+ messages in thread