Unable to use innodb_buffer_pool_chunk_size > 3934M with large pages

Description

Unable to set innodb_buffer_pool_chunk_size to more than 3934M

To reproduce set the following parameters in my.cnf:

 

innodb_buffer_pool_size = 3936M innodb_buffer_pool_instances = 1 innodb_buffer_pool_chunk_size = 3936M

Diagnostics:

In this case we request one buffer pool instance with a single chunk of 3936M. But we see the following:

mysql> SELECT pool_size as "real pool size (pages)", -> @@innodb_page_size as "page size (bytes)", -> @@innodb_buffer_pool_chunk_size/1024/1024 as "innodb_buffer_pool_chunk_size (MB)", -> @@innodb_buffer_pool_size/1024/1024 as "innodb_buffer_pool_size (MB)" -> FROM information_schema.INNODB_BUFFER_POOL_STATS\G *************************** 1. row *************************** real pool size (pages): 122 page size (bytes): 16384 innodb_buffer_pool_chunk_size (MB): 3936.00000000 innodb_buffer_pool_size (MB): 3936.00000000 1 row in set (0.00 sec)

It corresponds with pmap output:

Address Perm Offset Device Inode Size Rss Pss Referenced Anonymous LazyFree ShmemPmdMapped Shared_Hugetlb Private_Hugetlb Swap SwapPss Locked Mapping 00400000 r-xp 00000000 fc:00 852597 22648 12268 12268 12268 0 0 0 0 0 0 0 0 mysqld 01c1d000 r--p 0161d000 fc:00 852597 952 816 816 572 436 0 0 0 0 0 0 0 mysqld 01d0b000 rw-p 0170b000 fc:00 852597 700 500 500 500 200 0 0 0 0 0 0 0 mysqld ... ======= ====== ====== ========== ========= ======== ============== ============== =============== ==== ======= ====== 1434224 219648 214842 219148 199060 0 0 0 4096 0 0 0 KB

The probable root cause of the behaviour is that function, used for chunk memory allocation in large page pool

void* os_mem_alloc_large( ulint* n, bool populate)

calculates size as follows:

size = ut_2pow_round(*n + (os_large_page_size - 1), os_large_page_size);

First argument of ut_2pow_round is of type ulint and the second is uint.

Result size will be of type uint (upper bits are zeroed) because of ut_2pow_round implementation:

#define ut_2pow_round(n, m) ((n) & ~((m) - 1))

Environment

Oracle Linux Server release 7.5

4.14.35-1844.4.5.el7uek.x86_64

Smart Checklist

Activity

Show:

Lalit Choudhary July 17, 2019 at 8:25 AM

Hello

Marking this issue as a duplicate of  https://perconadev.atlassian.net/browse/PS-5517#icft=PS-5517, If see this as a different issue then please let us know.

Lalit Choudhary July 16, 2019 at 9:51 AM

Hello

Thank you for the report.

Could please help to understand what is expected here. Because in this case, I see innodb_buffer_pool_chunk_size has the size what we set in mysql configuration as following,

Do you see any error/warning in mysql log?

Test:

innodb_buffer_pool_size = 3936M innodb_buffer_pool_instances = 1 innodb_buffer_pool_chunk_size = 3936M
mysql [localhost] {msandbox} ((none)) > SELECT pool_size as "real pool size (pages)", -> @@innodb_page_size as "page size (bytes)", -> @@innodb_buffer_pool_chunk_size/1024/1024 as "innodb_buffer_pool_chunk_size (MB)", -> @@innodb_buffer_pool_size/1024/1024 as "innodb_buffer_pool_size (MB)" -> FROM information_schema.INNODB_BUFFER_POOL_STATS\G *************************** 1. row *************************** real pool size (pages): 251903 page size (bytes): 16384 innodb_buffer_pool_chunk_size (MB): 3936.00000000 innodb_buffer_pool_size (MB): 3936.00000000 1 row in set (0.00 sec)
Duplicate

Details

Assignee

Reporter

Labels

Affects versions

Priority

Smart Checklist

Created July 12, 2019 at 12:04 PM
Updated March 6, 2024 at 12:01 PM
Resolved July 17, 2019 at 8:25 AM