Skip to content
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

Remove unncessary mutex usage in the secondary network CNI cache #3232

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

jianjuns
Copy link
Contributor

The cache itself uses cache.Indexer which is thread-safe, and so needs
not the mutex to protect cache accesses. The mutex should be used just
for protecting CNIConfigInfo.PodCNIDeleted, which is written by
CNIServer and read by the secondary network Pod controller.

Signed-off-by: Jianjun Shen [email protected]

The cache itself uses cache.Indexer which is thread-safe, and so needs
not the mutex to protect cache accesses. The mutex should be  used just
for protecting CNIConfigInfo.PodCNIDeleted, which is written by
CNIServer and read by the secondary network Pod controller.

Signed-off-by: Jianjun Shen <[email protected]>
@jianjuns jianjuns requested a review from antoninbas January 22, 2022 05:47
@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2022

Codecov Report

Merging #3232 (c3c7068) into main (df6094b) will increase coverage by 1.15%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3232      +/-   ##
==========================================
+ Coverage   58.76%   59.91%   +1.15%     
==========================================
  Files         331      331              
  Lines       28437    28429       -8     
==========================================
+ Hits        16711    17034     +323     
+ Misses       9894     9519     -375     
- Partials     1832     1876      +44     
Flag Coverage Δ
kind-e2e-tests 47.95% <0.00%> (+2.33%) ⬆️
unit-tests 41.34% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/secondarynetwork/cnipodcache/cache.go 0.00% <0.00%> (ø)
pkg/apiserver/certificate/certificate.go 69.44% <0.00%> (-6.95%) ⬇️
pkg/ipam/poolallocator/allocator.go 50.00% <0.00%> (-1.16%) ⬇️
pkg/agent/util/net_linux.go 32.07% <0.00%> (-0.95%) ⬇️
pkg/ovs/openflow/ofctrl_packetout.go 79.60% <0.00%> (-0.79%) ⬇️
pkg/agent/agent.go 51.07% <0.00%> (+0.17%) ⬆️
pkg/agent/controller/networkpolicy/reconciler.go 77.19% <0.00%> (+0.20%) ⬆️
...ntroller/networkpolicy/networkpolicy_controller.go 82.64% <0.00%> (+0.47%) ⬆️
...gent/controller/noderoute/node_route_controller.go 54.91% <0.00%> (+0.54%) ⬆️
pkg/agent/route/route_linux.go 46.50% <0.00%> (+0.57%) ⬆️
... and 22 more

Copy link
Contributor

@arunvelayutham arunvelayutham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jianjuns. LGTM.

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jianjuns
Copy link
Contributor Author

/test-all

@jianjuns
Copy link
Contributor Author

/test-integration

@jianjuns jianjuns merged commit 6770e9c into antrea-io:main Mar 10, 2022
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.

4 participants