Fix huge_pages on Windows
authorMichael Paquier <michael@paquier.xyz>
Sat, 17 Sep 2022 06:39:55 +0000 (15:39 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 17 Sep 2022 06:39:55 +0000 (15:39 +0900)
commitfdd8937c071e85e2b7606939fb28284f008e15d1
tree373cc89c706181b399889f967b0cc506debb0afe
parenta0b65155d04e3d78e1ee92d5e3c6c340c7c6b286
Fix huge_pages on Windows

Since Windows 10 1703, it is additionally necessary to pass a flag
called FILE_MAP_LARGE_PAGES to MapViewOfFile() to enable large pages at
map time.  This flag is ignored on older versions of Windows, where
large pages should still be able to work properly without setting it.
Note that the flag would be set only for binaries that knew about it at
compile-time, which should be more or less all the Windows environments
these days.

Since 495ed0e, Windows 10 is the minimum version of Windows supported by
Postgres, making this change easy to reason about on HEAD.  Per
discussion, no backpatch is done for the moment.

Reported-by: Okano Naoki
Author: Thomas Munro
Reviewed-by: Tom Lane, Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/17448-0a96583a67edb1f7@postgresql.org
src/backend/port/win32_shmem.c