Open Bug 1649140 Opened 5 years ago Updated 1 year ago

Investigate using thread-local arenas in real-time threads

Categories

(Core :: Audio/Video: cubeb, enhancement)

enhancement

Tracking

()

People

(Reporter: padenot, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

Attached file lockstat-threadname.py

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.

Attached file With arenas enabled

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.

We see we're locking much much less with arenas enabled.

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.

Depends on: 1364359
Attachment #9160059 - Attachment mime type: text/x-log → text/plain
Attachment #9160058 - Attachment mime type: text/x-log → text/plain

(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.

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.

Attachment #9160060 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: