projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: fix incorrect counter
[userspace-rcu.git]
/
tests
/
rcutorture.h
diff --git
a/tests/rcutorture.h
b/tests/rcutorture.h
index b42b8ab7c828a52fd06ed9ddc187e498b3589d30..f8548d811ed8980061716cc797a63524d97524a4 100644
(file)
--- a/
tests/rcutorture.h
+++ b/
tests/rcutorture.h
@@
-56,7
+56,7
@@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 5
9 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ * Foundation, Inc., 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
*
* Copyright (c) 2008 Paul E. McKenney, IBM Corporation.
*/
*
* Copyright (c) 2008 Paul E. McKenney, IBM Corporation.
*/
@@
-66,7
+66,6
@@
*/
#include <stdlib.h>
*/
#include <stdlib.h>
-#include "../urcu-call-rcu.h"
DEFINE_PER_THREAD(long long, n_reads_pt);
DEFINE_PER_THREAD(long long, n_updates_pt);
DEFINE_PER_THREAD(long long, n_reads_pt);
DEFINE_PER_THREAD(long long, n_updates_pt);
@@
-80,7
+79,8
@@
char argsbuf[64];
#define GOFLAG_RUN 1
#define GOFLAG_STOP 2
#define GOFLAG_RUN 1
#define GOFLAG_STOP 2
-int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))) = GOFLAG_INIT;
+volatile int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE)))
+ = GOFLAG_INIT;
#define RCU_READ_RUN 1000
#define RCU_READ_RUN 1000
@@
-119,6
+119,7
@@
int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))) = GOFLAG_INIT;
void *rcu_read_perf_test(void *arg)
{
void *rcu_read_perf_test(void *arg)
{
+ struct call_rcu_data *crdp;
int i;
int me = (long)arg;
long long n_reads_local = 0;
int i;
int me = (long)arg;
long long n_reads_local = 0;
@@
-126,9
+127,10
@@
void *rcu_read_perf_test(void *arg)
rcu_register_thread();
run_on(me);
uatomic_inc(&nthreadsrunning);
rcu_register_thread();
run_on(me);
uatomic_inc(&nthreadsrunning);
+ put_thread_offline();
while (goflag == GOFLAG_INIT)
poll(NULL, 0, 1);
while (goflag == GOFLAG_INIT)
poll(NULL, 0, 1);
-
mark_rcu_quiescent_stat
e();
+
put_thread_onlin
e();
while (goflag == GOFLAG_RUN) {
for (i = 0; i < RCU_READ_RUN; i++) {
rcu_read_lock();
while (goflag == GOFLAG_RUN) {
for (i = 0; i < RCU_READ_RUN; i++) {
rcu_read_lock();
@@
-141,6
+143,9
@@
void *rcu_read_perf_test(void *arg)
}
__get_thread_var(n_reads_pt) += n_reads_local;
put_thread_offline();
}
__get_thread_var(n_reads_pt) += n_reads_local;
put_thread_offline();
+ crdp = get_thread_call_rcu_data();
+ set_thread_call_rcu_data(NULL);
+ call_rcu_data_free(crdp);
rcu_unregister_thread();
return (NULL);
rcu_unregister_thread();
return (NULL);
@@
-153,7
+158,7
@@
void *rcu_update_perf_test(void *arg)
if ((random() & 0xf00) == 0) {
struct call_rcu_data *crdp;
if ((random() & 0xf00) == 0) {
struct call_rcu_data *crdp;
- crdp = create_call_rcu_data(0);
+ crdp = create_call_rcu_data(0
, -1
);
if (crdp != NULL) {
fprintf(stderr,
"Using per-thread call_rcu() worker.\n");
if (crdp != NULL) {
fprintf(stderr,
"Using per-thread call_rcu() worker.\n");
@@
-204,6
+209,10
@@
void perftestrun(int nthreads, int nreaders, int nupdaters)
(double)n_reads),
((duration * 1000*1000*1000.*(double)nupdaters) /
(double)n_updates));
(double)n_reads),
((duration * 1000*1000*1000.*(double)nupdaters) /
(double)n_updates));
+ if (get_cpu_call_rcu_data(0)) {
+ fprintf(stderr, "Deallocating per-CPU call_rcu threads.\n");
+ free_all_cpu_call_rcu_data();
+ }
exit(0);
}
exit(0);
}
@@
-278,9
+287,10
@@
void *rcu_read_stress_test(void *arg)
int pc;
rcu_register_thread();
int pc;
rcu_register_thread();
+ put_thread_offline();
while (goflag == GOFLAG_INIT)
poll(NULL, 0, 1);
while (goflag == GOFLAG_INIT)
poll(NULL, 0, 1);
-
mark_rcu_quiescent_stat
e();
+
put_thread_onlin
e();
while (goflag == GOFLAG_RUN) {
rcu_read_lock();
p = rcu_dereference(rcu_stress_current);
while (goflag == GOFLAG_RUN) {
rcu_read_lock();
p = rcu_dereference(rcu_stress_current);
@@
-378,7
+388,7
@@
void *rcu_fake_update_stress_test(void *arg)
if ((random() & 0xf00) == 0) {
struct call_rcu_data *crdp;
if ((random() & 0xf00) == 0) {
struct call_rcu_data *crdp;
- crdp = create_call_rcu_data(0);
+ crdp = create_call_rcu_data(0
, -1
);
if (crdp != NULL) {
fprintf(stderr,
"Using per-thread call_rcu() worker.\n");
if (crdp != NULL) {
fprintf(stderr,
"Using per-thread call_rcu() worker.\n");
@@
-436,6
+446,10
@@
void stresstest(int nreaders)
printf(" %lld", sum);
}
printf("\n");
printf(" %lld", sum);
}
printf("\n");
+ if (get_cpu_call_rcu_data(0)) {
+ fprintf(stderr, "Deallocating per-CPU call_rcu threads.\n");
+ free_all_cpu_call_rcu_data();
+ }
exit(0);
}
exit(0);
}
This page took
0.02528 seconds
and
4
git commands to generate.