Skip to content

rcu-list: Fix the data-race #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2023
Merged

rcu-list: Fix the data-race #17

merged 1 commit into from
Jun 4, 2023

Conversation

linD026
Copy link
Collaborator

@linD026 linD026 commented Jun 3, 2023

Instead of using the old implementation of thread-rcu [1], let's use the newest and correct one, thread-rcu/rcu.h. And, to avoid the data race while we traverse the linked list, introduce the for loop API, list_for_each_entry_rcu.

After we changed the implementation and used the new for loop API, it doesn't report the data race:

$ make
cc -o test test.c -g -Wall -std=c99 -fsanitize=thread -D'READER_NUM=10' -D'UPDATER_NUM=1' -D'TRACE_LOOP=1000' -D'CONFIG_TRACE_TIME' -lpthread $ ./test
[tracer] loop 1000 : 2367069575.000000 ns

[1] https://github.com/linD026/parallel-programs/blob/main/rcu/thrd-based-rcu/thrd_rcu.h

Instead of using the old implementation of thread-rcu [1], let's use
the newest and correct one, thread-rcu/rcu.h. And, to avoid the data
race while we traverse the linked list, introduce the for loop API,
list_for_each_entry_rcu.

After we changed the implementation and used the new for loop API, it
doesn't report the data race:

$ make
cc -o test test.c -g -Wall -std=c99 -fsanitize=thread -D'READER_NUM=10' -D'UPDATER_NUM=1' -D'TRACE_LOOP=1000' -D'CONFIG_TRACE_TIME' -lpthread
$ ./test
[tracer] loop 1000 : 2367069575.000000 ns

[1] https://github.com/linD026/parallel-programs/blob/main/rcu/thrd-based-rcu/thrd_rcu.h
@jserv jserv merged commit 342506f into sysprog21:master Jun 4, 2023
@jserv
Copy link
Contributor

jserv commented Jun 4, 2023

Thank @linD026 for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants