-
Notifications
You must be signed in to change notification settings - Fork 68
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
[Performance] Frequent usage of mutex
significantly slows down performance.
#816
Comments
mutex
significantly slows down performance.
Thanks for your discovery. We also found that the current implementation of locks is quite time-consuming when testing RamFS and the latency of a single syscall. |
Each asterinas/kernel/aster-nix/src/vm/vmar/vm_mapping.rs Lines 59 to 63 in c9cfb98
Each call to
I think 5 times come from here: asterinas/kernel/aster-nix/src/vm/vmar/mod.rs Lines 877 to 911 in c9cfb98
asterinas/kernel/aster-nix/src/vm/vmar/mod.rs Lines 423 to 429 in c9cfb98
|
|
We use a simple bandwidth testing program that utilizes
send
andrecv
, and we found that asterinas's bandwidth still lags behind Linux by nearly 8 times. We attempted to identify the performance bottleneck and used performance measurement tools to discover that a significant amount of time is consumed by locking and unlocking functions. The function consuming the most time isaster_frame::sync::wait::WaitQueue::wake_one()
, rather than functions related to the network protocol stack, which is highly abnormal. Below are the statistics from our performance testing tool. The higher the count for a function, the more time is spent on that function.time consumption statistics for each function
Subsequently, through breakpoint statistics, we analyzed which functions extensively use locks. Below are the specific statistics.
<style> </style>From our current perspective, the bottleneck in network bandwidth performance lies within the memory systems and process management system. The excessive use of locks, particularly mutexes instead of lighter-weight locks, has prevented smoltcp from achieving its nominal bandwidth performance.
Perhaps next, we can focus on improving performance by:
1、Optimizing
aster_frame::sync::wait::WaitQueue::wake_one()
.2、Reducing the usage of mutexes, or replacing them with lighter-weight locks.
The text was updated successfully, but these errors were encountered: