4GB Limit on large_pages shared memory set-up
General
Escalation
General
Escalation
Description
Environment
None
AFFECTED CS IDs
249759
Smart Checklist
Activity
Show:
George Lorch August 16, 2019 at 4:25 PM
Sveta Smirnova March 27, 2019 at 7:10 AM
Copying relevant part of the source code invetigation from the upstream bug report:
If I set a breakpoint at shmget call:
https://github.com/mysql/mysql-server/blob/5.7/storage/innobase/os/os0proc.cc#L91
(gdb) p *n
$4 = 4397727744
(gdb) p size
$5 = 102760448size is calculated as:
size = ut_2pow_round(*n + (os_large_page_size - 1),
os_large_page_size);Round is defined as:
#define ut_2pow_round(n, m) (👎 & ~((m) - 1))(gdb) p (( *n + (os_large_page_size - 1) ) & ~(( os_large_page_size ) - 1))
$6 = 102760448The result became correct after converting ~((m) - 1) to uint64_t:
(gdb) p (( *n + (os_large_page_size - 1) ) & ~(( os_large_page_size ) - 1UL))
$7 = 4397727744
Done
Details
Details
Assignee
Zsolt Parragi
Zsolt ParragiReporter
Nickolay Ihalainen
Nickolay Ihalainen(Deactivated)Labels
Time tracking
4h 22m logged
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

Open Smart Checklist
Created March 24, 2019 at 8:52 AM
Updated March 6, 2024 at 12:15 PM
Resolved July 4, 2019 at 11:06 AM
Large pages allocations with innodb buffer pool chunk 4GB and more causing incorrect size for memory segment.
--large-pages --innodb_buffer_pool_chunk_size=4G
I've started mysqld as root, but it's also possible to see the same issue with proper value for /proc/sys/vm/hugetlb_shm_group:
https://dev.mysql.com/doc/refman/8.0/en/large-page-support.html
sync; echo 3 > /proc/sys/vm/drop_caches
echo 5120 > /proc/sys/vm/nr_hugepages # 10GB
ulimit -l unlimited
bin/mysqld --no-defaults --user=root --datadir=$PWD/data --lc-messages-dir=$PWD/share/english --initialize-insecure --skip-networking
bin/mysqld --no-defaults --user=root --datadir=$PWD/data --lc-messages-dir=$PWD/share/english --socket=$PWD/data/mysqld.sock --skip-networking --innodb_buffer_pool_instances=2 --large-pages --innodb_buffer_pool_chunk_size=4G --innodb_buffer_pool_size=8G
ipcs -m