-
Notifications
You must be signed in to change notification settings - Fork 6
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
bpf: Overwrite the htab element atomically #4946
base: bpf-next_base
Are you sure you want to change the base?
bpf: Overwrite the htab element atomically #4946
Conversation
Upstream branch: 03f3aa4 |
9ce1c32
to
30c33d1
Compare
Upstream branch: 03f3aa4 |
d6c00ef
to
001c073
Compare
30c33d1
to
2029cce
Compare
Upstream branch: 03f3aa4 |
001c073
to
3cfd4ab
Compare
2029cce
to
79342df
Compare
Upstream branch: 12befeb |
3cfd4ab
to
e70b366
Compare
79342df
to
1a4be3f
Compare
Upstream branch: 0abff46 |
e70b366
to
a3097ad
Compare
1a4be3f
to
934ebcd
Compare
Upstream branch: 003be25 |
a3097ad
to
f7a6eea
Compare
934ebcd
to
c899019
Compare
Upstream branch: ea145d5 |
f7a6eea
to
641ea19
Compare
c899019
to
43059e3
Compare
Upstream branch: 9b6cdaf |
641ea19
to
e288715
Compare
43059e3
to
fd4295c
Compare
Upstream branch: 733c3fa |
e288715
to
a84bbb7
Compare
fd4295c
to
706a1e5
Compare
Add hlist_nulls_replace_rcu() to replace an existing element in the hash list. For the concurrent list traversal, the replace is atomic, it will find either the old element or the new element. Signed-off-by: Hou Tao <[email protected]>
Currently, the update of existing element in hash map involves two steps: 1) insert the new element at the head of the hash list 2) remove the old element It is possible that the concurrent lookup operation may fail to find either the old element or the new element if the lookup operation starts before the addition and continues after the removal. Therefore, replacing the two-step update with an atomic update. After the change, the update will be atomic in the perspective of the lookup operation: it will either find the old element or the new element. Signed-off-by: Hou Tao <[email protected]>
Add a test case to verify the atomic update of existing element in hash map. The test proceeds in three steps: 1) fill the map with keys in the range [0, 63] 2) create 8 threads to lookup these keys concurrently 3) create 2 threads to overwrite these keys concurrently Without atomic update support, the lookup operation may return -ENOENT error and the test will fail. After the atomic-update change, the lookup operation will always return 0 and the test will succeed. Signed-off-by: Hou Tao <[email protected]>
Upstream branch: 4107a1a |
a84bbb7
to
2228bc7
Compare
Pull request for series with
subject: bpf: Overwrite the htab element atomically
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=930344