mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 05:33:06 +00:00
Add batching to arena bins.
This adds a fast-path for threads freeing a small number of allocations to bins which are not their "home-base" and which encounter lock contention in attempting to do so. In producer-consumer workflows, such small lock hold times can cause lock convoying that greatly increases overall bin mutex contention.
This commit is contained in:
committed by
David Goldblatt
parent
44d91cf243
commit
fc615739cb
@@ -1,32 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
static void
|
||||
wait_for_child_exit(int pid) {
|
||||
int status;
|
||||
while (true) {
|
||||
if (waitpid(pid, &status, 0) == -1) {
|
||||
test_fail("Unexpected waitpid() failure.");
|
||||
}
|
||||
if (WIFSIGNALED(status)) {
|
||||
test_fail("Unexpected child termination due to "
|
||||
"signal %d", WTERMSIG(status));
|
||||
break;
|
||||
}
|
||||
if (WIFEXITED(status)) {
|
||||
if (WEXITSTATUS(status) != 0) {
|
||||
test_fail("Unexpected child exit value %d",
|
||||
WEXITSTATUS(status));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#include "test/fork.h"
|
||||
|
||||
TEST_BEGIN(test_fork) {
|
||||
#ifndef _WIN32
|
||||
@@ -64,7 +37,7 @@ TEST_BEGIN(test_fork) {
|
||||
/* Child. */
|
||||
_exit(0);
|
||||
} else {
|
||||
wait_for_child_exit(pid);
|
||||
fork_wait_for_child_exit(pid);
|
||||
}
|
||||
#else
|
||||
test_skip("fork(2) is irrelevant to Windows");
|
||||
@@ -87,7 +60,7 @@ do_fork_thd(void *arg) {
|
||||
test_fail("Exec failed");
|
||||
} else {
|
||||
/* Parent */
|
||||
wait_for_child_exit(pid);
|
||||
fork_wait_for_child_exit(pid);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -124,7 +97,7 @@ TEST_BEGIN(test_fork_multithreaded) {
|
||||
do_test_fork_multithreaded();
|
||||
_exit(0);
|
||||
} else {
|
||||
wait_for_child_exit(pid);
|
||||
fork_wait_for_child_exit(pid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user