summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2019-01-29 13:25:40 -0500
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2020-02-09 23:26:06 -0800
commitd3fefdb69439292ec914cd8c65dd83ed1bcbdc65 (patch)
tree9aabd8732427d08f984af22492cd04f7f44cb9a0
parentcf2df3b000c58155d3c83bd01b603894b4559c0b (diff)
downloadgperftools-d3fefdb69439292ec914cd8c65dd83ed1bcbdc65.tar.gz
Allow configuring page size to 4K, 8K, 16K, 32K, 64K, 128K and 256K
-rw-r--r--INSTALL5
-rw-r--r--configure.ac17
-rw-r--r--src/common.h6
-rw-r--r--src/windows/config.h9
4 files changed, 20 insertions, 17 deletions
diff --git a/INSTALL b/INSTALL
index f9a6a11..cfb6b97 100644
--- a/INSTALL
+++ b/INSTALL
@@ -113,8 +113,9 @@ To build libtcmalloc with large pages you need to use the
./configure <other flags> --with-tcmalloc-pagesize=32
-The ARG argument can be 8, 32 or 64 which sets the internal page size to
-8K, 32K and 64K repectively. The default is 8K.
+The ARG argument can be 4, 8, 16, 32, 64, 128 or 256 which sets the
+internal page size to 4K, 8K, 16K, 32K, 64K, 128K and 256K respectively.
+The default is 8K.
*** SMALL TCMALLOC CACHES: TRADING SPACE FOR TIME
diff --git a/configure.ac b/configure.ac
index cabfcae..60457ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,7 +109,7 @@ AC_ARG_ENABLE([libunwind],
[enable_libunwind="$default_enable_libunwind"])
AC_ARG_WITH([tcmalloc-pagesize],
[AS_HELP_STRING([--with-tcmalloc-pagesize],
- [Set the tcmalloc internal page size to 8K, 32K or 64K])],
+ [Set the tcmalloc internal page size to 4K, 8K, 16K, 32K, 64K, 128K or 256K])],
[],
[with_tcmalloc_pagesize=$default_tcmalloc_pagesize])
AC_ARG_WITH([tcmalloc-alignment],
@@ -119,15 +119,22 @@ AC_ARG_WITH([tcmalloc-alignment],
[with_tcmalloc_alignment=$default_tcmalloc_alignment])
case "$with_tcmalloc_pagesize" in
+ 4)
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 12);;
8)
#Default tcmalloc page size.
;;
+ 16)
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 14);;
32)
- AC_DEFINE(TCMALLOC_32K_PAGES, 1,
- [Define 32K of internal pages size for tcmalloc]);;
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 15);;
64)
- AC_DEFINE(TCMALLOC_64K_PAGES, 1,
- [Define 64K of internal pages size for tcmalloc]);;
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 16);;
+ 128)
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 17);;
+ 256)
+ AC_DEFINE(TCMALLOC_PAGE_SIZE_SHIFT, 18,
+ [Define internal page size for tcmalloc as number of left bitshift]);;
*)
AC_MSG_WARN([${with_tcmalloc_pagesize}K size not supported, using default tcmalloc page size.])
esac
diff --git a/src/common.h b/src/common.h
index cb45315..e0e461a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -72,10 +72,8 @@ static const size_t kMinAlign = 16;
// the thread cache allowance to avoid passing more free ranges to and from
// central lists. Also, larger pages are less likely to get freed.
// These two factors cause a bounded increase in memory use.
-#if defined(TCMALLOC_32K_PAGES)
-static const size_t kPageShift = 15;
-#elif defined(TCMALLOC_64K_PAGES)
-static const size_t kPageShift = 16;
+#if defined(TCMALLOC_PAGE_SIZE_SHIFT)
+static const size_t kPageShift = TCMALLOC_PAGE_SIZE_SHIFT;
#else
static const size_t kPageShift = 13;
#endif
diff --git a/src/windows/config.h b/src/windows/config.h
index 4598ceb..65ca354 100644
--- a/src/windows/config.h
+++ b/src/windows/config.h
@@ -316,15 +316,12 @@
/* the namespace where STL code like vector<> is defined */
#define STL_NAMESPACE std
-/* Define 32K of internal pages size for tcmalloc */
-/* #undef TCMALLOC_32K_PAGES */
-
-/* Define 64K of internal pages size for tcmalloc */
-/* #undef TCMALLOC_64K_PAGES */
-
/* Define 8 bytes of allocation alignment for tcmalloc */
/* #undef TCMALLOC_ALIGN_8BYTES */
+/* Define internal page size for tcmalloc as number of left bitshift */
+/* #undef TCMALLOC_PAGE_SIZE_SHIFT */
+
/* Version number of package */
#define VERSION "2.7"