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 1pUAvd-0002Dj-Bu for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2023 18:30:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUAvc-0007Bh-7Z for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2023 18:30:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUAvb-0007BT-7E for pgsql-hackers@lists.postgresql.org; Mon, 20 Feb 2023 18:30:19 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUAvW-0000BJ-Iu for pgsql-hackers@lists.postgresql.org; Mon, 20 Feb 2023 18:30:17 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id B70D63200201; Mon, 20 Feb 2023 13:30:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 20 Feb 2023 13:30:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1676917812; x=1677004212; bh=7Cr1jWcEGX kpS4YtAIEXI+EIze/WrnhJt+N4/SJ7Huk=; b=DgIdGqQdykeB9B9SbQNcaJ/Frk 2Y7aDMP7pe/y3EcmcPcdQV7fCTleYSUZ5YEJkbAsqI4iIrSTf9omuac6oO++mQxE d65HGDDjZsONIye6/XwZS9ckfCAzgLwJ65r/aqaFR/4e+RWY4uJiib0+8prEZv7g Be2s321DjpOzK9TKyS3AkH2JQhLHDC8g2NqxWV7Dv/EXAznjNBl1FItBvK8zZWjy S7NfY2tW3nd+4x6Tju8aJ6xDruxxSifs+21cvvLiLb0G98MsOffG/LggKjj8GN+6 4+FH8zRz/FQtHrKy8zbgHtMR/+JcIYvC9jEMwkbA3KAqjECnbZkSvnBkwbKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1676917812; x=1677004212; bh=7Cr1jWcEGXkpS4YtAIEXI+EIze/W rnhJt+N4/SJ7Huk=; b=Y27UR/un7Eg7Mfg6D9MMgy2nvtxcSb91aKLMRHbEHhIp 17gxx6WS7nNoTEw+808Onjwcpikc4yWSQr5/B9p+a0KxWVCeDuZViysl7WlTzvID bnynmis0j1cDF4KBJCgBoh3jcG7EtvnK0QTORsgMjV2HCoudrcsFbJJoguyUIrOY RGugNcRW5QH2nDktnbnJYw6nGa1GZvvDOp63SvmJHeiuRNG+3LQms7QQW8yDQPiw KcItVA7Cewc9dxW2vWR6s+Rh7weabQ8wx4dItT91BkA97kSOr0aEpNe8x2Pvkkk7 xlmW8Qs6G6ekA5IJS0we8ILzdd5CnPjxx2pCfmSCBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejhedguddtjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Feb 2023 13:30:11 -0500 (EST) Date: Mon, 20 Feb 2023 10:30:10 -0800 From: Andres Freund To: David Rowley Cc: "Jonah H. Harris" , PostgreSQL Hackers Subject: Re: Reducing System Allocator Thrashing of ExecutorState to Alleviate FDW-related Performance Degradations Message-ID: <20230220183010.kwasdlkgug6veacd@awork3.anarazel.de> References: <20230217003204.cx5zu2aocjbwz5ns@awork3.anarazel.de> <20230217034000.ddcklsr6hfdifyqk@awork3.anarazel.de> <20230217175201.lspbj47wnjxhastu@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230217175201.lspbj47wnjxhastu@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-02-17 09:52:01 -0800, Andres Freund wrote: > On 2023-02-17 17:26:20 +1300, David Rowley wrote: > Random note: > > I wonder if we should having a bitmap (in an int) in front of aset's > freelist. In a lot of cases we incur plenty cache misses, just to find the > freelist bucket empty. Two somewhat related thoughts: 1) We should move AllocBlockData->freeptr into AllocSetContext. It's only ever used for the block at the head of ->blocks. We completely unnecessarily incur more cache line misses due to this (and waste a tiny bit of space). 2) We should introduce an API mcxt.c API to perform allocations that the caller promises not to individually free. We've talked a bunch about introducing a bump allocator memory context, but that requires using dedicated memory contexts, which incurs noticable space overhead, whereas just having a separate function call for the existing memory contexts doesn't have that issue. For aset.c we should just allocate from set->freeptr, without going through the freelist. Obviously we'd not round up to a power of 2. And likely, at least outside of assert builds, we should not have a chunk header. Greetings, Andres Freund