Implement PAGE_FLOOR macro
This commit is contained in:
parent
52631c90f6
commit
5bf03f8ce5
@ -13,6 +13,9 @@
|
|||||||
/* Return the smallest pagesize multiple that is >= s. */
|
/* Return the smallest pagesize multiple that is >= s. */
|
||||||
#define PAGE_CEILING(s) \
|
#define PAGE_CEILING(s) \
|
||||||
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
(((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. */
|
/* Huge page size. LG_HUGEPAGE is determined by the configure script. */
|
||||||
#define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE))
|
#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) {
|
const sec_opts_t *opts) {
|
||||||
assert(opts->max_alloc > 0);
|
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;
|
pszind_t npsizes = sz_psz2ind(max_alloc) + 1;
|
||||||
|
|
||||||
size_t sz_shards = opts->nshards * sizeof(sec_shard_t);
|
size_t sz_shards = opts->nshards * sizeof(sec_shard_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user