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 1w8eKu-000kEq-26 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 13:13:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8eKt-00Bgla-0k for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 13:13:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8eKs-00BglS-30 for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 13:13:19 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8eKr-00000000NVk-01oY for pgsql-hackers@postgresql.org; Fri, 03 Apr 2026 13:13:19 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-488a041eae5so1886385e9.1 for ; Fri, 03 Apr 2026 06:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775221991; cv=none; d=google.com; s=arc-20240605; b=UDydpaCdhxruCyYyBGXTScrSoFiZtR7+Yi42tiMfG2i6fTGLN1lzukmG227wuYeEE0 xI2hIGzOJFDk+0wb98oT9cUCkjIPkzk6baUnNx0gt5qEXjfDQB41fNaBNERU7SeUu2uw Yq26lv6KbodgYf1VdQQTEERQYGizxch1I+OsAupEd/LB/3iidFEJyyGM+v6KfmrEF1bj 8nrFvVjWt5IGneV2socEDujCQQIvl2Uo+0e2gJAx1FSRq4+enUZ/nHrRrj3SM5RHrWNq SMEvF5Y8/1ZeAD6/x9TKuA0/DXevVEBDuf81Sfm141Bo9FGn6QLc72EePOmDcZjU37cN FbaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i3B0UTbkJ7KdSb2rBTV3TBH+Lcu6okQXAKNnvT3TLlA=; fh=rHo4WQfr0cWFNw9U4N2vx7IlIGud7HeRPfGt+pR65bo=; b=FfwWZti1hhg7KSWwqdLoH5gk3XJrS86nOUjJHfZabBU2UPejznSBAL/+h7PrTjoI5r 34TvQ0WFhRFTU2Jcs4UmA2J6R5bEaUgptAtQtAchadyiDO1VFbMDA+ILlWc5LF+WNwCt w7UkS0oxzeyq34rK8juS/VwFRZyAaUHgJU7222owv790k8EP42CRvb6k378F4Iht8YOc H6D/Z6hHFzk7DHbRafm3ngqAOJGlwUI68v2eKWYGo/go2OF4kzUejxSjm6vFmKjj5G70 KI+6xjXh1IYQ9FYz+xT4RdzVDGkCc8H4MJUs/XZNdmpblWhwPKi6MPCBIwIEpmXH4Jzh 1lmQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775221991; x=1775826791; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=i3B0UTbkJ7KdSb2rBTV3TBH+Lcu6okQXAKNnvT3TLlA=; b=C6ebfkWxSJT19VMfshGBCuL2udZ9llS5mhtcq3DkH34YuRwe7ZYGG7/L5mkh6hyDO2 a/fsRt+jgTx8NQP4D0CwANGo3ndlsL0IF28DA7unm03hm94DHOuWPWsgHyMHd0uHlRT8 6N8CH6Z+ZGBiMWfDsSbl2/BVlY0o3qk8TTICqsWwwPLL8IPzgMYtp91cOonfvUva+4VA XBVFTiVha9i2l+pHf+LOy492rw8MWFOfvAt/Ob/FuYkcZmRdtUQbybXqIrXYhwTxW4yK 1OAURlrxpOFzgnnKK7MI+p6oyDv47P04p30VgD0Yp/lqZ3PclVdYN5H3VgXOgK/hRO8O VWVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775221991; x=1775826791; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i3B0UTbkJ7KdSb2rBTV3TBH+Lcu6okQXAKNnvT3TLlA=; b=NICdkLEP/KI8T+pxhwNfR6eUD6umKTQ9MFsCTtpCOjs9vMifIUqMGJrBKqc8tpbMOf xYLYJmV7m2lIfi5mW9WHeBaxjvDxkS3ZpeN2We14Egl28n+rLoT/9U62ugWjKBX2vist Hq9unLeotJidND+/DVpEp38/jhWrzr7CQ8GoOGGu6QUuju/PBvT8ZW7rcIOZwpWxHr28 B2NUB34HakHI4eS/es82gvfnYQMfH7RMhakUn/WPD2O3ploUNwWo/IWDgU/VrsMaqmLB +zjWX6zJ7GDUWrT1M2mwFPJ6hshrbbT2IKi9rryxDwUhD/X0UkinH2WXqvB4/seLVIZS mo6w== X-Forwarded-Encrypted: i=1; AJvYcCUuu7WTzCbVY0Pgy6nUX6L1Si+T9E1kimok2tc+TbG84CWpgCpBtZD/W6Xeu166KMUJc8BuuJ9dzKZdI3st@postgresql.org X-Gm-Message-State: AOJu0Yx7GiwUbWxdsIkGdV4cAPTJxAVuAg0hWrfQbe9UXb5ScLMyMV3A 6bPiNnAU1N2Eb+3yj1IbSgkp6iea6vO7Y61Edw7RSypqs2xWHFAqwBAoTzlbSWoeGSa3JUQTH9o UHRzZeKF49nNErg1yKkRbrA7SMaMoPKk= X-Gm-Gg: ATEYQzwz8fOs3GD8m6ttBoeB8ycn4vCagfCLfDVGPYomAcwGnQwCrSN2uxNYNd/zgf/ VF2VFqcJboaxgccrcjw+6252CsxYouC/HG+kVIPfzZyW+MBUEwS6WWJ6EHh0WyEQw3uzqY9uYeP qABHSWeoSsh5+2B5ai2bLh0m8pJeQDlaPpx5IuwiIpwiO7pukwpkj+J13KfDM1lLqe/+mvWjP7h Nr9YwpkQEtLsVGJp77muKwXRZrgY2qQYr33uP/mTOzxHQkNk5dxkJTFMAyu6/MH2Dh4TGmjFahF OvE397No067UevQZWq1BOLLxeLnti0UCsfx1EC2I6CJRvoU9lfbNqHy8oxO+tA== X-Received: by 2002:a05:600c:4f11:b0:486:f9aa:2b57 with SMTP id 5b1f17b1804b1-488997b3aa5mr50242895e9.16.1775221990844; Fri, 03 Apr 2026 06:13:10 -0700 (PDT) MIME-Version: 1.0 References: <8a6799be-bd42-49fb-8914-856c97bb1977@iki.fi> <113724ab-0028-493f-9605-6e8570f0939f@iki.fi> <791c3f18-f4de-4d84-ac6b-c7ccc074dd38@iki.fi> <9d919bd9-94dd-4bda-8ccf-ebced4178c53@iki.fi> In-Reply-To: From: Ashutosh Bapat Date: Fri, 3 Apr 2026 18:42:58 +0530 X-Gm-Features: AQROBzA7tTbn250BADkqsk4SVVqNgpljDa0PqoNHfRihLilJ__nUVwKvuN8mxjA Message-ID: Subject: Re: Better shared data structure management and resizable shared data structures To: Matthias van de Meent Cc: Heikki Linnakangas , Robert Haas , Andres Freund , pgsql-hackers , chaturvedipalak1911@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Apr 3, 2026 at 3:40=E2=80=AFAM Matthias van de Meent wrote: > > On Wed, 1 Apr 2026 at 20:17, Heikki Linnakangas wrote: > > > > While I do think it's an improvement over the current APIs, the > improvement seems to be mostly concentrated in the RequestStruct/Hash > department, with only marginal improvements in RegisterShmemCallbacks. > I feel like it's missing the important part: I'd like > direct-from-_PG_init() ShmemRequestStruct/Hash calls. If > ShmemRequestStruct/Hash had a size callback as alternative to the size > field (which would then be called after preload_libraries finishes) > then that would be sufficient for most shmem allocations, and it'd > simplify shmem management for most subsystems. > We'd still need the shmem lifecycle hooks/RegisterShmemCallbacks to > allow conditionally allocated shmem areas (e.g. those used in aio), > but I think that, in general, we shouldn't need a separate callback > function just to get started registering shmem structures. > > I also noticed that ShmemCallbacks.%_arg are generally undocumented, > and I couldn't find any users in core (at the end of the patchset) > that actually use the argument. Could it be I missed something? > > I don't understand the use of ShmemStructDesc. They generally/always > are private to request_fn(), and their fields are used exclusively > inside the shmem mechanisms, with no reads of its fields that can't > already be deduced from context. Why do we need that struct > everywhere? My resizable shared memory structure patches use it as a handle to the structure to be resized. --=20 Best Wishes, Ashutosh Bapat