Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZsaF-0007yf-RA for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Mar 2022 11:03:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZsaE-0002Te-EN for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Mar 2022 11:03:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZsaE-0002TU-4R for pgsql-bugs@lists.postgresql.org; Thu, 31 Mar 2022 11:03:18 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nZsaB-00043b-Gu for pgsql-bugs@lists.postgresql.org; Thu, 31 Mar 2022 11:03:17 +0000 Received: by mail-pj1-x102a.google.com with SMTP id y16so10927286pju.4 for ; Thu, 31 Mar 2022 04:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=k2h8WLljRVhkwrvP/nJy+g0FqncFL1rADecLggm31gw=; b=eA2qY4QQD7+ZGlHC7UEekyn2J6/fv5TY64dUZmBbooZYJQQYB4E5WrxK2G46iZTryp 86GKnPq3J5b/vRSuITS42KWKl5p7D4YcAkKe0rknGexB4v/S0FX3AAkZ2XrI+/2Apr0L W57uPGh7lE1vnULMSIWXZ9B6x+8K48Pi3yqXkk0zqdq4Ud6PVcKFKQlCiHyeT275k2YT 9s/00F7/UZD/BVUFKy+ejSOmwfW+dv2t7siqhi8WVqxEHQhKtzvx2Yz8CNNAndxmIDm0 M9l70mJyURUgwmzmekRBr6c+XjwfdI3xhzjq6VG+wdO5tUsc8EeZCyumgQSFPkHtqz1X hz1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=k2h8WLljRVhkwrvP/nJy+g0FqncFL1rADecLggm31gw=; b=35OB1jPt2qRroz5YdmpVm/XN9/TCSsT+dZAtJZm9Yzkxh7qN3bepd56XPUItddudZP 2ZSSDcgeUZzOVbxS1OXzk9aJb8+yf5W0a9qRwdb9H17XFdoPdNIsOHddWGdg55SX9FwV +MmqgPWl/CV7IjKlEzsewRmVf6SZ/uX5N1PJ6s8L5cxZBXp40OR3yYKxpj98BHpNVLsV 4HWxXo9Yg84+n06qe3UWaosH8E6ULTYRZttbGXWUCZZEGExHNiJwWLCWB4bqeMfezoVa c6c6ltUzTSBtht+arVRSMN98CB6gtZ1psvlDQabVP4StgZjMiv5+GnqCiIF5eglJ+xTf p3AQ== X-Gm-Message-State: AOAM531xikLG1nsq1OPIhfnkSKTPSpf07U9IhzYMi5Ln9sUuWwBeAg01 tHZFVp12b0efT8rsk35q0QQ= X-Google-Smtp-Source: ABdhPJwBmjEEVfl8WsScrX7r+bi0qcx/WswjBRWlsVlqpWY9VzvCO/qVq2skpaYjyot6TkFTo2pTkQ== X-Received: by 2002:a17:902:d512:b0:154:7580:6e78 with SMTP id b18-20020a170902d51200b0015475806e78mr4578194plg.35.1648724592842; Thu, 31 Mar 2022 04:03:12 -0700 (PDT) Received: from jrouhaud (2001-b011-1005-b35e-8420-3e61-3201-4aba.dynamic-ip6.hinet.net. [2001:b011:1005:b35e:8420:3e61:3201:4aba]) by smtp.gmail.com with ESMTPSA id l18-20020a056a00141200b004f75395b2cesm27272893pfu.150.2022.03.31.04.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 04:03:12 -0700 (PDT) Date: Thu, 31 Mar 2022 19:03:09 +0800 From: Julien Rouhaud To: Michael Paquier Cc: Thomas Munro , okano.naoki@jp.fujitsu.com, PostgreSQL mailing lists Subject: Re: BUG #17448: In Windows 10, version 1703 and later, huge_pages doesn't work. Message-ID: <20220331110309.ws25d6dl5yyzprye@jrouhaud> References: <17448-0a96583a67edb1f7@postgresql.org> <20220326082408.moh55zuecxjmewnm@jrouhaud> <20220331045908.bm5edcacvymgwwv2@jrouhaud> <20220331080055.hjrrsrd4lxwlt7f5@jrouhaud> <20220331104659.ol6pqe7s3tpkymuk@jrouhaud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331104659.ol6pqe7s3tpkymuk@jrouhaud> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 31, 2022 at 06:46:59PM +0800, Julien Rouhaud wrote: > On Thu, Mar 31, 2022 at 04:00:55PM +0800, Julien Rouhaud wrote: > > > Okano-san has mentioned VMMap upthread: > > > https://docs.microsoft.com/en-us/sysinternals/downloads/vmmap > > > > Yes, I totally missed that. Thomas Munro also mentioned it off-list, and > > also found some reference [1] indicating that large pages should show up as > > "Locked WS". I tested with and without the patch and in both case I don't see > > any "Locked WS" usage. I also get the same Page Table size, which seems > > consistent with large pages not being used. Now, this is a vm running with > > virtualbox and we're not entirely sure that huge pages can be allocated with > > it. I wish I could test on my windows 10 machine as it's not virtualized, but > > I can't give the required privileges. > > > > [1] https://aloiskraus.wordpress.com/2016/10/03/windows-10-memory-compression-and-more/ > > So, after more digging it turns out that the patch is supposed to work. If I > force using the PG_FILE_MAP_LARGE_PAGES, postgres starts and I do see "Locked > WS" usage with VMMap, with a size in the order of magnitude of my > shared_buffers. > > What is apparently not working on my VM is IsWindowsVersionOrGreater(10, 0, > 1703). I added some debug around to check what GetVersionEx() [2] is saying, > and I get: > > dwMajorVersion == 6 > dwMinorVersion == 2 > dwBuildNumber == 9200 > > While winver.exe on the same vm says windows 11, version 21H2, build 22000.493. So, what GetVersionEx returns is actually "it depends", and this is documented: > With the release of Windows 8.1, the behavior of the GetVersionEx API has > changed in the value it will return for the operating system version. The > value returned by the GetVersionEx function now depends on how the > application is manifested. > > Applications not manifested for Windows 8.1 or Windows 10 will return the > Windows 8 OS version value (6.2). Once an application is manifested for a > given operating system version, GetVersionEx will always return the version > that the application is manifested for in future releases. To manifest your > applications for Windows 8.1 or Windows 10, refer to Targeting your > application for Windows. There's no such indication on IsWindowsVersionOrGreater(), but after seeing various comments on forums from angry people, it may be a hint that it behaves similarly. I'm not sure what to do at this point, maybe just always use the flag (the PG_ version which may be 0), hoping that hopefully windows won't define it if it can't handle it?