InnoDB: mmap failed; errno 12 I am getting following error after modifying the innodb buffer pool size values.

InnoDB: mmap(137428992 bytes) failed; errno 12
InnoDB: Cannot allocate memory for the buffer pool


137428992 is innodb_buffer_pool_chunk_size.

I am having a machine with 256 GB RAM.

Following is what I added to my.cnf

innodb_buffer_pool_size=200G 
innodb_buffer_pool_instances=40


All the other values are default. Resolution for similar questions are either increase RAM or decrease buffer pool size. If I monitor the memory usage when mysqld is starting, I see that it increases to 8-9 GB before the failure occurs. 

Following is free -g output

              total        used        free      shared  buff/cache   available
Mem:            251           2         247           0           1         248
Swap:             3           0           3


What could be causing this issue?
You are probably running the service on Linux. I've had similar problems with allocating large amounts of memory on Linux (as opposed to BSD) even if the amount of memory I was trying to allocate was reasonable in proportion to the system's total memory.

MySQL suggests having innodb_buffer_pool_size / innodb_buffer_pool_chunk_size &lt; 1000. https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_buffer_pool_chunk_size

Right now you are at about 1455. Try setting innodb_buffer_pool_chunk_size = 274857984. Or even 549715968.

This will also change the allocation pattern on the OS level which might help the operation to succeed. Also adding some swap could help the allocation to succeed by providing even more addressable virtual memory - not that the swap would ever actually be used.