-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime/race: eliminate cgo call overheads #4249
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
Comments
FTR, here is the profile for 'go test regexp'. The first part is race detector itself (23%) and the second part is various thunks (37%). If we implement custom asm thunks for raceread/write/funcenter/funcexit, the second part can be cut to >5% I think. The custom thunks must do the following: 0. For read/write check that the addr is not on stack. 1. Extract racectx from current g. 2. Extract caller pc from stack. 3. Switch stack to g0. 4. Do static call of __tsan_read/write/..., pass racectx, pc, addr. 5. Switch stack back. 11.34% regexp.test regexp.test [.] __tsan_read 4.03% regexp.test regexp.test [.] __tsan_write 1.50% regexp.test regexp.test [.] __tsan_func_enter 1.36% regexp.test regexp.test [.] __tsan_func_exit 1.01% regexp.test regexp.test [.] __tsan::Mutex::ReadLock() 0.79% regexp.test regexp.test [.] __tsan::Mutex::ReadUnlock() 0.47% regexp.test regexp.test [.] __tsan::SyncTab::GetAndLock(__tsan::ThreadState*, unsigned long, unsigned long, bool, bool) 0.40% regexp.test regexp.test [.] __tsan::ThreadClock::acquire(__tsan::SyncClock const*) 0.38% regexp.test regexp.test [.] __tsan_write_range 0.38% regexp.test regexp.test [.] __tsan_read_range 0.36% regexp.test regexp.test [.] __tsan::Mutex::Lock() 0.31% regexp.test regexp.test [.] __tsan::ThreadClock::release(__tsan::SyncClock*) const 0.18% regexp.test regexp.test [.] __tsan::Mutex::Unlock() 0.17% regexp.test regexp.test [.] __tsan::Acquire(__tsan::ThreadState*, unsigned long, unsigned long) 0.12% regexp.test regexp.test [.] __tsan::Release(__tsan::ThreadState*, unsigned long, unsigned long) 0.12% regexp.test regexp.test [.] __tsan::ThreadClock::ReleaseStore(__tsan::SyncClock*) const 0.10% regexp.test regexp.test [.] __tsan::SyncTab::PartIdx(unsigned long) 23% total 11.23% regexp.test regexp.test [.] runtime.asmcgocall 6.34% regexp.test regexp.test [.] runtime.raceread 4.24% regexp.test regexp.test [.] runtime.cgocall 2.73% regexp.test regexp.test [.] runtime.racewrite 2.55% regexp.test regexp.test [.] runtime/race.Read 1.73% regexp.test regexp.test [.] runtime/race._Cfunc___tsan_read 1.32% regexp.test regexp.test [.] runtime.racefuncenter 1.21% regexp.test regexp.test [.] runtime/race.Write 0.82% regexp.test regexp.test [.] _cgo_12e5d96e021c_Cfunc___tsan_read 0.75% regexp.test regexp.test [.] runtime.racefuncexit 0.69% regexp.test regexp.test [.] runtime.getcallerpc 0.67% regexp.test regexp.test [.] runtime/race._Cfunc___tsan_write 0.66% regexp.test regexp.test [.] runtime/race.FuncEnter 0.45% regexp.test regexp.test [.] runtime/race._Cfunc___tsan_func_enter 0.44% regexp.test regexp.test [.] runtime/race.FuncExit 0.38% regexp.test regexp.test [.] _cgo_12e5d96e021c_Cfunc___tsan_write 0.37% regexp.test regexp.test [.] runtime/race._Cfunc___tsan_func_exit 0.15% regexp.test regexp.test [.] runtime.gentraceback 0.14% regexp.test regexp.test [.] runtime.raceacquireg 0.12% regexp.test regexp.test [.] _cgo_12e5d96e021c_Cfunc___tsan_func_exit 0.11% regexp.test regexp.test [.] _cgo_12e5d96e021c_Cfunc___tsan_func_enter 0.07% regexp.test regexp.test [.] runtime.RaceAcquire 37% total |
This issue was closed by revision a1695d2. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: