Investigate using thread-local arenas in real-time threads
Categories
(Core :: Audio/Video: cubeb, enhancement)
Tracking
()
People
(Reporter: padenot, Unassigned)
References
(Depends on 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
Following my profiler work, I'm investigating lock contention on our real-time threads.
Attached is a python script (originally from https://github.com/goldshtn/linux-tracing-workshop/blob/master/lockstat-solution.py and modified) that measures the time it takes to wait for a lock, and then the time spent inside the locked region.
http://www.brendangregg.com/blog/2016-06-14/ubuntu-xenial-bcc-bpf.html has instructions to install the right packages for ubuntu, and then by running the script like so:
sudo python2 lockstat-solution.py <tab pid>
the init stacks, lock stacks, aggregated wait time, aggregated hold time, enter count are dumped on stdout each for each 5 seconds time period (roughly).
Attached is a run of https://padenot.github.io/loopa/ being profiled with the Gecko profiler, with and without calls to https://searchfox.org/mozilla-central/source/memory/build/malloc_decls.h#100 at the beginning of the AudioIPC thread and the GraphRunner thread, on a Linux build.
Reporter | ||
Comment 1•5 years ago
|
||
Format is the following:
A list of init stack for each lock created.
A list of threads with their name. For each thread a list of lock acquisition during a 5s time duration, separated by stacks.
Reporter | ||
Comment 2•5 years ago
|
||
We see we're locking much much less with arenas enabled.
Reporter | ||
Comment 3•5 years ago
|
||
Reporter | ||
Comment 4•5 years ago
|
||
We can't do this right now, because there is no solution to dispose of arenas (bug 1364359), but the numbers are interesting I think and I wanted this recorded somewhere.
![]() |
||
Updated•5 years ago
|
![]() |
||
Updated•5 years ago
|
Comment 5•5 years ago
|
||
(I know nothing about this bug)
Just FWIW, Bug 1610720 made arenas can be disposed of by calling moz_dispose_arena
if the arena is free.
Reporter | ||
Comment 6•5 years ago
|
||
Sean, thank you very much for mentioning this, very useful. I assume we need a bit more discipline with the alloc lifetime before using this (I haven't tried yet), but it's a path forward.
Updated•1 year ago
|
Description
•