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 1oLWhu-0003BY-Ig for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Aug 2022 21:24:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLWgv-0000xU-7F for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Aug 2022 21:23:09 +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 1oLWgu-0000xL-UN for pgsql-hackers@lists.postgresql.org; Tue, 09 Aug 2022 21:23:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLWgs-00071N-31 for pgsql-hackers@lists.postgresql.org; Tue, 09 Aug 2022 21:23:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 279LN08s085734; Tue, 9 Aug 2022 17:23:00 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , David Rowley , Yura Sokolov , PostgreSQL Developers Subject: Re: Reducing the chunk header sizes on all memory context types In-reply-to: <20220809210258.o7to2ymxuaq2j76r@awork3.anarazel.de> References: <9dec1bd42fed3e263de294116380e5b51c427267.camel@postgrespro.ru> <20220712174404.polbc5it7j6mzmql@awork3.anarazel.de> <20220809184410.g6yzu6pvttuphag5@awork3.anarazel.de> <36081.1660072917@sss.pgh.pa.us> <20220809210258.o7to2ymxuaq2j76r@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 09 Aug 2022 14:02:58 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <85732.1660080180.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 09 Aug 2022 17:23:00 -0400 Message-ID: <85733.1660080180@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2022-08-09 15:21:57 -0400, Tom Lane wrote: >> Do we really need it to be that tight? I know we only have 3 methods t= oday, >> but 8 doesn't seem that far away. If there were six bits reserved for >> this I'd be happier. > We only have so many bits available, so that'd have to come from some ot= her > resource. The current division is: > + * 1. 3-bits to indicate the MemoryContextMethodID > + * 2. 1-bit to indicate if the chunk is externally managed (see below) > + * 3. 30-bits for the amount of memory which was reserved for the chunk > + * 4. 30-bits for the number of bytes that must be subtracted from the = chunk > + * to obtain the address of the block that the chunk is stored on. > I suspect we could reduce 3) here a bit, which I think would end up with= slab > context's max chunkSize shrinking further. Which should still be fine. Hmm, I suppose you mean we could reduce 4) if we needed to. Yeah, that seems like a reasonable place to buy more bits later if we run out of MemoryContextMethodIDs. Should be fine then. regards, tom lane