aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-03-19 03:40:26 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-03-19 03:40:26 +0100
commitc23a93cb1fff07653d491e7967a713455c7d2555 (patch)
tree3b6121c9b791f6f33fa36d1e0ab41753f5e0d4b1
parent6a865bd9ff9f73813fc6a04ecba6941f44fdc41b (diff)
downloadallocbench-c23a93cb1fff07653d491e7967a713455c7d2555.tar.gz
allocbench-c23a93cb1fff07653d491e7967a713455c7d2555.zip
add glibc allocator definitions
-rw-r--r--allocators/glibc_2.28_no_passive_falsesharing_fancy.patch25
-rw-r--r--allocators/glibcs.py37
2 files changed, 62 insertions, 0 deletions
diff --git a/allocators/glibc_2.28_no_passive_falsesharing_fancy.patch b/allocators/glibc_2.28_no_passive_falsesharing_fancy.patch
new file mode 100644
index 0000000..044909b
--- /dev/null
+++ b/allocators/glibc_2.28_no_passive_falsesharing_fancy.patch
@@ -0,0 +1,25 @@
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 27cf6137c2..fbd311801d 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -4172,6 +4172,12 @@ _int_free (mstate av, mchunkptr p, int have_lock)
+
+ #if USE_TCACHE
+ {
++ /* Check if chunk is from our own arena or false sharing is not possible
++ because the chunk is cache line aligned and it's size is a multiple
++ of a cacheline */
++ if (av == thread_arena
++ || (((size_t)p & 63) == 0 && ((size + 2*SIZE_SZ) % 64) == 0))
++ {
+ size_t tc_idx = csize2tidx (size);
+ if (tcache != NULL && tc_idx < mp_.tcache_bins)
+ {
+@@ -4201,6 +4207,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
+ return;
+ }
+ }
++ }
+ }
+ #endif
+
diff --git a/allocators/glibcs.py b/allocators/glibcs.py
new file mode 100644
index 0000000..891bf15
--- /dev/null
+++ b/allocators/glibcs.py
@@ -0,0 +1,37 @@
+import os
+import subprocess
+
+from src.allocator import *
+from src.allocator import Allocator as Alloc
+from src.allocator import Allocator_Sources as Alloc_Src
+
+optimisation_flag = "-O2"
+
+glibc_src = Alloc_Src("glibc",
+ retrieve_cmds=["git clone git://sourceware.org/git/glibc.git"],
+ prepare_cmds=["git checkout release/2.29/master"],
+ reset_cmds=["git stash"])
+
+glibc = Alloc("glibc", sources=glibc_src,
+ build_cmds=["mkdir -p glibc-build",
+ "cd glibc-build; {srcdir}/configure --prefix={dir}",
+ "cd glibc-build; make",
+ "cd glibc-build; make install"],
+ cmd_prefix="{dir}/lib/ld-linux-x86-64.so.2 --library-path {dir}/lib:"+library_path)
+
+glibc_notc = Alloc("glibc_notc", sources=glibc_src,
+ build_cmds=["mkdir -p glibc-build",
+ "cd glibc-build; {srcdir}/configure --prefix={dir} --disable-experimental-malloc",
+ "cd glibc-build; make",
+ "cd glibc-build; make install"],
+ cmd_prefix="{dir}/lib/ld-linux-x86-64.so.2 --library-path {dir}/lib:"+library_path)
+
+glibc_nofs = patch_alloc("glibc_nofs", glibc,
+ ["allocators/glibc_2.28_no_passive_falsesharing.patch"])
+
+glibc_nofs_fancy = patch_alloc("glibc_nofs_fancy", glibc,
+ ["allocators/glibc_2.28_no_passive_falsesharing_fancy.patch"])
+
+allocators_to_build = [glibc, glibc_notc, glibc_nofs, glibc_nofs_fancy]
+
+allocators = {a.name: a.build() for a in allocators_to_build}