diff options
author | Daniel Black <daniel@mariadb.org> | 2021-12-02 14:30:26 +1100 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-01-18 14:20:57 +0200 |
commit | d434250ee1d5b180ba311cc77219c36bddc9dd46 (patch) | |
tree | 255d48065d16de54bfbd136ca21fb8bb7221c6cd /mysys | |
parent | e5b75ac3d74843b2487d6ff1ef55c9d5230a185e (diff) | |
download | mariadb-git-d434250ee1d5b180ba311cc77219c36bddc9dd46.tar.gz |
MDEV-25342: autosize innodb_buffer_pool_chunk_size
The previous default innodb_buffer_pool_chunk_size of 128M
made sense when the innodb buffer pool size was a few GB.
When the pool size is 128GB this means the chunk size is 0.1%
of this. Fine tuning the buffer pool size on such a fine
increment doesn't make practical sense. Also on extremely
large buffer pool systems, initializing on the default 128M can
also take a considerable amount of time.
When large pages are enabled, the chunk size has to be a multiple
of an available large page size or memory allocation without
use can occur.
Previously the default 0 was documented as disabling resizing.
With srv_buf_pool_chunk_unit > 0 assertions in the code and the
minimium value set, I doubt this was ever the case.
As such the autosizing (based on default 0) takes place as follows:
* a 64th of the innodb_buffer_pool_size
* if large pages, this is rounded down the the nearest multiple
of the large page size.
* If less than 1MB, set to 1MB.
This does mean the new default innodb_buffer_pool_chunk size is
2MB, derived form the above formular with 128MB as the buffer pool
size.
The innodb_buffer_pool_chunk_size is changed to a size_t for
better compatiblity with the memory allocations which use size_t.
The previous upper limit is changed to the maxium of a size_t. The
maximium value used is the buffer pool size anyway.
Getting this default value of the chunk size to a more practical
size facilitates further development of more automated resizing
without significant overhead or memory fragmentation.
innodb_buffer_pool_resize test adjusted based on 1M default
chunk size thanks Wlad.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_largepage.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 0fdc4e17a26..9cc1e19772b 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -251,6 +251,28 @@ int my_init_large_pages(my_bool super_large_pages) } +/** + Large page size helper. + This rounds down, if needed, the size parameter to the largest + multiple of an available large page size on the system. +*/ +void my_large_page_truncate(size_t *size) +{ + if (my_use_large_pages) + { + size_t large_page_size= 0; +#ifdef _WIN32 + large_page_size= my_large_page_size; +#elif defined(HAVE_MMAP) + int page_i= 0; + large_page_size= my_next_large_page_size(*size, &page_i); +#endif + if (large_page_size > 0) + *size-= *size % large_page_size; + } +} + + #if defined(HAVE_MMAP) && !defined(_WIN32) /* Solaris for example has only MAP_ANON, FreeBSD has MAP_ANONYMOUS and MAP_ANON but MAP_ANONYMOUS is marked "for compatibility" */ |