Skip to content

Avoid blocking on background thread lock for stats.#1510

Merged
interwq merged 1 commit intojemalloc:devfrom
interwq:bgthd
May 22, 2019
Merged

Avoid blocking on background thread lock for stats.#1510
interwq merged 1 commit intojemalloc:devfrom
interwq:bgthd

Conversation

@interwq
Copy link
Contributor

@interwq interwq commented May 22, 2019

Background threads may run for a long time, especially when the # of dirty pages
is high. Avoid blocking stats calls because of this (which may cause latency
spikes).

Resolves #1502.

Background threads may run for a long time, especially when the # of dirty pages
is high.  Avoid blocking stats calls because of this (which may cause latency
spikes).
Copy link
Contributor

@yinan1048576 yinan1048576 left a comment

Choose a reason for hiding this comment

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

Looks great! One nit - see below.

* Each background thread run may take a long time;
* avoid waiting on the stats if the thread is active.
*/
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to have a counter or something so that the caller can know how many background threads succeeded? E.g. instead of returning a bool, return an unsigned counter so that the caller can know more details if desired? May not be immediately useful though given the current way this function is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep it could be useful if we decide to report detailed per thread stats -- right now only the aggregated numbers are shown.

@interwq interwq merged commit 1a71533 into jemalloc:dev May 22, 2019
@interwq interwq deleted the bgthd branch May 22, 2019 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mallctl("epoch") is very slow in some scenario

2 participants