diff options
author | Alex Lapenkou <lapenkov@fb.com> | 2022-03-22 14:33:04 -0700 |
---|---|---|
committer | Alexander Lapenkov <lapenkov.a@yandex.ru> | 2022-03-22 17:45:55 -0700 |
commit | 5bf03f8ce5802b90a16b595e962fe4f07ce7fe93 (patch) | |
tree | a938f76deb3eae9ec8198be77ac0cceb56f7f1b8 | |
parent | 52631c90f664ded0a5106a7d5fd906d46a7c1f81 (diff) | |
download | jemalloc-5bf03f8ce5802b90a16b595e962fe4f07ce7fe93.tar.gz |
Implement PAGE_FLOOR macro
-rw-r--r-- | include/jemalloc/internal/pages.h | 3 | ||||
-rw-r--r-- | src/sec.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/jemalloc/internal/pages.h b/include/jemalloc/internal/pages.h index 3d7993dd..ad1f606a 100644 --- a/include/jemalloc/internal/pages.h +++ b/include/jemalloc/internal/pages.h @@ -13,6 +13,9 @@ /* Return the smallest pagesize multiple that is >= s. */ #define PAGE_CEILING(s) \ (((s) + PAGE_MASK) & ~PAGE_MASK) +/* Return the largest pagesize multiple that is <=s. */ +#define PAGE_FLOOR(s) \ + ((s) & ~PAGE_MASK) /* Huge page size. LG_HUGEPAGE is determined by the configure script. */ #define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE)) @@ -25,7 +25,7 @@ sec_init(tsdn_t *tsdn, sec_t *sec, base_t *base, pai_t *fallback, const sec_opts_t *opts) { assert(opts->max_alloc > 0); - size_t max_alloc = opts->max_alloc & ~PAGE_MASK; + size_t max_alloc = PAGE_FLOOR(opts->max_alloc); pszind_t npsizes = sz_psz2ind(max_alloc) + 1; size_t sz_shards = opts->nshards * sizeof(sec_shard_t); |