From 321e29d945372e2195082b95c7740e1d79ed5b55 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 23 Jun 2009 11:25:28 -0400 Subject: [PATCH] Add local reclaim tests Signed-off-by: Mathieu Desnoyers --- Makefile | 12 +++++++++++- Makefile64 | 12 +++++++++++- runtests.sh | 1 + test_qsbr_gc.c | 6 ++++++ test_urcu_gc.c | 6 ++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2f18129..e8d11bb 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,8 @@ all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \ test_perthreadlock test_urcu_yield test_urcu_mb \ urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ urcutorture-yield liburcu.so test_mutex test_looplen test_urcu_gc \ - test_urcu_gc_mb test_qsbr_gc + test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \ + test_urcu_lgc_mb checkarch: ifeq (${ARCHTYPE},) @@ -70,12 +71,21 @@ test_urcu_gc: urcu.o test_urcu_gc.c urcu.h test_urcu_gc_mb: urcu-mb.o test_urcu_gc.c urcu.h $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) +test_urcu_lgc: urcu.o test_urcu_gc.c urcu.h + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_lgc_mb: urcu-mb.o test_urcu_gc.c urcu.h + $(CC) -DTEST_LOCAL_GC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_qsbr_gc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) +test_qsbr_lgc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + test_rwlock: urcu.o test_rwlock.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) diff --git a/Makefile64 b/Makefile64 index bebc2b4..9c65568 100644 --- a/Makefile64 +++ b/Makefile64 @@ -29,7 +29,8 @@ all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \ test_perthreadlock test_urcu_yield test_urcu_mb \ urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ urcutorture-yield liburcu.so test_mutex test_looplen test_urcu_gc \ - test_urcu_gc_mb test_qsbr_gc + test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \ + test_urcu_lgc_mb checkarch: ifeq (${ARCHTYPE},) @@ -65,12 +66,21 @@ test_urcu_gc: urcu.o test_urcu_gc.c urcu.h test_urcu_gc_mb: urcu-mb.o test_urcu_gc.c urcu.h $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) +test_urcu_lgc: urcu.o test_urcu_gc.c urcu.h + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_lgc_mb: urcu-mb.o test_urcu_gc.c urcu.h + $(CC) -DTEST_LOCAL_GC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_qsbr_gc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) +test_qsbr_lgc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + test_rwlock: urcu.o test_rwlock.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) diff --git a/runtests.sh b/runtests.sh index 3b06f84..981aef1 100755 --- a/runtests.sh +++ b/runtests.sh @@ -1,6 +1,7 @@ #!/bin/sh for a in test_urcu_gc test_urcu_gc_mb test_urcu test_urcu_mb \ + test_urcu_lgc test_qsbr_lgc test_urcu_lgc_mb \ test_qsbr test_qsbr_gc test_rwlock test_perthreadlock \ test_mutex; do echo "./${a} $*" | tee -a runall.detail.log diff --git a/test_qsbr_gc.c b/test_qsbr_gc.c index f38477e..3a66a84 100644 --- a/test_qsbr_gc.c +++ b/test_qsbr_gc.c @@ -250,7 +250,11 @@ static void rcu_gc_reclaim(unsigned long wtidx, void *old) void *thr_writer(void *data) { unsigned long wtidx = (unsigned long)data; +#ifdef TEST_LOCAL_GC + struct test_array *old = NULL; +#else struct test_array *new, *old; +#endif printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "writer", pthread_self(), (unsigned long)gettid()); @@ -263,9 +267,11 @@ void *thr_writer(void *data) smp_mb(); for (;;) { +#ifndef TEST_LOCAL_GC new = malloc(sizeof(*new)); new->a = 8; old = _rcu_xchg_pointer(&test_rcu_pointer, new); +#endif rcu_gc_reclaim(wtidx, old); nr_writes++; if (unlikely(!test_duration_write())) diff --git a/test_urcu_gc.c b/test_urcu_gc.c index 6d7d8ca..12ea181 100644 --- a/test_urcu_gc.c +++ b/test_urcu_gc.c @@ -251,7 +251,11 @@ static void rcu_gc_reclaim(unsigned long wtidx, void *old) void *thr_writer(void *data) { unsigned long wtidx = (unsigned long)data; +#ifdef TEST_LOCAL_GC + struct test_array *old = NULL; +#else struct test_array *new, *old; +#endif printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "writer", pthread_self(), (unsigned long)gettid()); @@ -264,9 +268,11 @@ void *thr_writer(void *data) smp_mb(); for (;;) { +#ifndef TEST_LOCAL_GC new = malloc(sizeof(*new)); new->a = 8; old = rcu_xchg_pointer(&test_rcu_pointer, new); +#endif rcu_gc_reclaim(wtidx, old); nr_writes++; if (unlikely(!test_duration_write())) -- 2.34.1