Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcz5P-003niV-0l for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2026 05:26:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcz5N-008w2b-06 for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2026 05:26:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcz5M-008w2S-2W for pgsql-bugs@lists.postgresql.org; Fri, 26 Jun 2026 05:26:40 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wcz5K-00000000I6s-3GJq for pgsql-bugs@lists.postgresql.org; Fri, 26 Jun 2026 05:26:39 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 737E4EC0012; Fri, 26 Jun 2026 01:26:37 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 26 Jun 2026 01:26:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1782451597; x=1782537997; bh=3eg2Uj/EUG XhpM9k+4qiFymZNx8peNLmzocE+EDXlTs=; b=IJRfF7TKkFSDe+vN9nCFU98NHN q1wKKndMrEC3xaDiOSjVmt0flE693s/1rE4u2nr8OPawJ/MhbmJM4kYXV4xckiWI Ok4hMMOTk+T7Wy4w0D58OhvIqkZzxET72QhRftvlPTIg8ah4UKJP1Yoh7PrACd5a UUEDQs5Bq1VdZS8eEO+0ZZvkdEQSdF5e1abzDalVNMIJpKVCLVgw53ku6vx49ihW rq8A+x3zBPii7wYq7zRK8a1U1Ab9hnvVb5DQPJuE/pIEFDHF8++tSiWCjX5D4e1c 9qKZ1ulzMpgOcbue4t/gmLccPUQ63Qpgkv5off6TW5xfEy8LTwXzQvSTfk1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1782451597; x=1782537997; bh=3eg2Uj/EUGXhpM9k+4qiFymZNx8peNLmzoc E+EDXlTs=; b=knaAsrlJJ/c0yN7n7IalJcf2xo8njFJn8I8kp62d325MA4Ve/5e NXQeCQ/Tc2bmjkoJ7xlWSMk0uXY2wYaqLxr1UXb0GvbcLR39V7kuNq+typoxiZxX 6jPK+exE0iPNloL9EjVYf0FFCHjOsPrrm5ZEx1yd28UQFUt/+YAvy7cp/IDs9PTi b0FeB3tV7b9GgL3F3cOWm/0SdVyB434xCNwU7xXzESfdfwsTu4K3+6JLCKiaP+kc B5RZa32XwoQDU4cILzZSkmgE3yuJltzFndEZOBVJxMtwOc67aFGRJTInuf3A8l9/ 7aTz8R7S01oGNUD21o3mzoWoloV5+b7brbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFor0bBIWvzBJ91UaN9WgaU3/0Aa2CdKzVe3RguIDWZlJ4touC9C6npN/IwSZVCem 1QOxNdSjfH1Em0NcIuFeYAGH/eA+LcsO6oXP8yYHGBTCE87mcKPjF6FP39NIEnvtxaQVKs UllEiJYbbZmTule6jRTQ1Vma5o9AdAgOJJyMW3EsTwKjyMN0j9R1JGciQPqrLEpFecGV8r eOlp7VrKGJd9Wxy5yfWkLvkNmH//UQQyC77N2eHfvlkQzTNCLfZrwhigBcnc44Buq5IDzD rcM/BC7HNAMKJhoPmsuMixJUOeFPKKlkxIqDBmXGbpRKqQfuqgHUGmCsV3mjyXrmHLGPc7 mi2OKhWNMjPhxctHbJsi7UOeHrFpQRXpMEx87eUt77083edTsFUvj5MkO+Y4mddeWbZ3jO clpdfZ0VRmRLFlper9lvMKRO4LR25lO04Nr/utRDcGMf4obC42xn7AJH1IIXPVNGYerTqL i5xcwPIpE8CN+ao6NPGYjyBioxdCyEnizCR836CMj6YdSm+nLa6un1hs+q0sdYCXvMi47Q NzHrbTv3C/B7acISu5QoROXVbeslcIyO+WMZmWIp44TXe9990NBOtSJQxGzIxkp7FmtrnF MqQBZ51Vv6wJj6CSCnzwq6LINeJccbxDhSZWVsfd1oNm7xvBZMDMvZkEjHDw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Jun 2026 01:26:35 -0400 (EDT) Date: Fri, 26 Jun 2026 14:26:31 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: vilensipkdm@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: Set huge_page_size on 32bit system Message-ID: References: <20260626.132415.904994526137946499.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dvO+DWcYnEl2ujit" Content-Disposition: inline In-Reply-To: <20260626.132415.904994526137946499.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dvO+DWcYnEl2ujit Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 26, 2026 at 01:24:15PM +0900, Kyotaro Horiguchi wrote: > We could also make the later calculation use a wider integer type, but > such a value would not be usable anyway on a platform where it does > not fit in Size. So it seems better to reject it earlier in > check_huge_page_size(), before reaching CreateAnonymousSegment(). The top of guc.h includes the following thing: /* * Maximum for integer GUC variables that are measured in kilobytes of memory. * This value is chosen to ensure that the corresponding number of bytes fits * into a variable of type size_t or ssize_t. Be sure to compute the number * of bytes like "guc_var * (Size) 1024" to avoid int-width overflow. */ #if SIZEOF_SIZE_T > 4 #define MAX_KILOBYTES INT_MAX #else #define MAX_KILOBYTES (INT_MAX / 1024) #endif So it seems to me that the mistake is that huge_page_size uses INT_MAX as upper bound. We should use MAX_KILOBYTES instead; this definition exists to exactly prevent this kind of computation mistake in 32b environments. -- Michael --dvO+DWcYnEl2ujit Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmo+DYcACgkQnvQgOdby QH1GrA//SsV2wj8KtWFcSNkK5SKuQU5eTAiqWsi+W2u28QDfZ+8zkz4ZZc4ipXn6 BOLlt4ZY9U0vi3Aw5jyhMOaNbCOFWz1wBj51gbIZVEoUBLGCmleCZmTjNNilbGPW woXr/G/YZ7uKXO4uqmpw/irtABIjak3BssUwjF+WyVDn7QNEFcIltOwMGF5VhJT4 StfpZSMAi7ShZfVFBMZlxR69S1ZdWmMfnHdw7yf+nzOJLxfCkrEZaRbdpOSUmIJ0 yMSGns3taozxOj3lcQ8dnYOzvhBRpQdrAaFWAH219sjvj7jR5E4IjBg7vtWtp4pk Z5E5ckj5GpWOxO5rXtsNEfqChpL4lxiA+72m2ZFL9ItidrX5UjMPXNGK4ntCGvLo ExnefDKEklzDXGR7KcvNTjMJc64cnp1myZRXQNkiK3tWEe+ozROBZ5m+bPPkp5m0 oTU8rfSqkpVuB2SdOPg9OPXwwNdqen3T+bYEkRW6iIhIIxSVaHp6jR4fklr3PJjC 7MFUj9Cx/6o27JqimU0pdDhRPFxjmJ+KhF5/8KsIAAtdSC/myNr/QxoVqDlZl1/7 DDfBKynhkm6tLCJRrAR2PWkt6wlRD41Y8OUvDWUlrdEi03LUC4Mi5H3UJOxyeWmV 3csKCK2rDJFF+o4I/LTz7LYajbyRoOhXdguwuTUHJ/6GuWHpn6k= =GnSD -----END PGP SIGNATURE----- --dvO+DWcYnEl2ujit--