]> git.sesse.net Git - stockfish/commit
Advise the kernel to use huge pages (Linux)
authorSami Kiminki <skiminki@users.noreply.github.com>
Sat, 21 Dec 2019 19:41:42 +0000 (21:41 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 27 Jan 2020 10:16:10 +0000 (11:16 +0100)
commit39437f4e55aaa26ef9f0d5a1c762e560e9ffde32
tree8bad9603a02ec8244b31f0878caf7fe40f4b5541
parent6d0eabd5fe2961551477820ab7619e2c31e01ffd
Advise the kernel to use huge pages (Linux)

Align the TT allocation by 2M to make it huge page friendly and advise the
kernel to use huge pages.

Benchmarks on my i7-8700K (6C/12T) box: (3 runs per bench per config)

                    vanilla (nps)               hugepages (nps)              avg
==================================================================================
bench             | 3012490  3024364  3036331   3071052  3067544  3071052    +1.5%
bench 16 12 20    | 19237932 19050166 19085315  19266346 19207025 19548758   +1.1%
bench 16384 12 20 | 18182313 18371581 18336838  19381275 19738012 19620225   +7.0%

On my box, huge pages have a significant perf impact when using a big
hash size. They also speed up TT initialization big time:

                                  vanilla (s)  huge pages (s)  speed-up
=======================================================================
time stockfish bench 16384 1 1  | 5.37         1.48            3.6x

In practice, huge pages with auto-defrag may always be enabled in the
system, in which case this patch has no effect. This
depends on the values in /sys/kernel/mm/transparent_hugepage/enabled
and /sys/kernel/mm/transparent_hugepage/defrag.

closes https://github.com/official-stockfish/Stockfish/pull/2463

No functional change
src/misc.cpp
src/misc.h
src/tt.cpp
src/tt.h