From: Steinar H. Gunderson Date: Sat, 24 Nov 2018 10:17:12 +0000 (+0100) Subject: Turn on MADV_RANDOM for Syzygy mmaps (on Unix-like builds) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=de7182f4eee33029a7b79f6b097db06357669127;hp=de7182f4eee33029a7b79f6b097db06357669127;p=stockfish Turn on MADV_RANDOM for Syzygy mmaps (on Unix-like builds) When running on a cloud VM (n1-highcpu-96) with several NVMe SSDs and some non-SSDs for tablebases, I noticed that the average SSD request size was more than 256 kB. This doesn't make a lot of sense for Syzygy tablebases, which have a block size of 32 bytes and very low locality. Seemingly, the tablebase access patterns during probing make the OS, at least Linux, think that readahead is advantageous; normally, it gives up doing readahead if there are too many misses, but it doesn't, perhaps due to the fairly high overall hit rates. (It seems the kernel cannot distinguish between reading a block that was paged in because the userspace wanted it explicitly, and one that was read as part of readahead.) Setting MADV_RANDOM effectively turns off readahead, which causes the request size to drop to 4 kB. In the aforemented cloud VM test, this roughly tripled the amount of I/O requests that were able to go through, while reducing the total traffic from 2.8 GB/sec to 56 MB/sec (moving the bottleneck to the non-SSDs; it seems the SSDs could have sustained many more requests). Closes https://github.com/official-stockfish/Stockfish/pull/1829 No functional change. ---