◼ Windows 10 バージョン 1703 以降では、このフラグは、大きなページのサポートを使用してビューをマッ プする必要があることを指定します。 ビューのサイズは 、GetLargePageMinimum 関数によって報告され る大きなページのサイズの倍数である必要があり、ファイル マッピング オブジェクト は SEC_LARGE_PAGES オプションを使用して作成されている必要があります。 lpBaseAddress に null 以外 の値を指定する場合、値は GetLargePageMinimum の倍数である必要があります。 ◼ https://learn.microsoft.com/ja-jp/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffileex ◆ ⇒ MapViewOfFileExをコールしているところで、 FILE_MAP_LARGE_PAGES をセットしていないのはバグじゃないか? ググっているとこんな情報を発見! /* * Get a pointer to the new shared memory segment. Map the whole segment * at once, and let the system decide on the initial address. */ memAddress = MapViewOfFileEx(hmap2, FILE_MAP_WRITE | FILE_MAP_READ, 0, 0, 0, NULL); if (!memAddress) ereport(FATAL, (errmsg("could not create shared memory segment: error code %lu", GetLastError()), errdetail("Failed system call was MapViewOfFileEx."))); 15.3
In Windows 10, version 1703 and later, huge_pages doesn't work. The following bug has been logged on the website: Bug reference: 17448 Logged by: Okano Naoki Email address: okano(dot)naoki(at)jp(dot)fujitsu(dot)com PostgreSQL version: 14.2 Operating system: Windows Description: With huge_pages = on, the postgres process does not appear to use large pages. I checked with VMMap if the large pages are used in the following environment. Environment PostgreSQL version: 14.2 Operating system : Windows 10 20H2 On this page (*) says that in Windows 10, version 1703 and later OS versions, you must specify the FILE_MAP_LARGE_PAGES flag with the MapViewOfFile function to map large pages. I think it seems to be the cause that MapViewOfFile() in src/backend/port/win32_shmem.c does not specify FILE_MAP_LARGE_PAGES flag. (*) MapViewOfFileEx function https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffileex FILE_MAP_LARGE_PAGES Starting with Windows 10, version 1703, this flag specifies that the view should be mapped using large page support. The size of the view must be a multiple of the size of a large page reported by the GetLargePageMinimum function, and the file-mapping object must have been created using the SEC_LARGE_PAGES option. If you provide a non-null value for lpBaseAddress, then the value must be a multiple of GetLargePageMinimum.
desiredAccess = FILE_MAP_WRITE | FILE_MAP_READ; #ifdef FILE_MAP_LARGE_PAGES /* Set large pages if wanted. */ if ((flProtect & SEC_LARGE_PAGES) != 0) desiredAccess |= FILE_MAP_LARGE_PAGES; #endif /* * Get a pointer to the new shared memory segment. Map the whole segment * at once, and let the system decide on the initial address. */ memAddress = MapViewOfFileEx(hmap2, desiredAccess, 0, 0, 0, NULL); if (!memAddress) ereport(FATAL, (errmsg("could not create shared memory segment: error code %lu", GetLastError()), errdetail("Failed system call was MapViewOfFileEx."))); 16beta1 FILE_MAP_LARGE_PAGES が設定されている