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 1pKUjK-0003HI-R2 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2023 01:37:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKUjJ-00027m-L5 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2023 01:37:37 +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 1pKUjJ-00025Z-78 for pgsql-hackers@lists.postgresql.org; Wed, 25 Jan 2023 01:37:37 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pKUjF-00057R-Qi for pgsql-hackers@postgresql.org; Wed, 25 Jan 2023 01:37:36 +0000 Received: by mail-il1-x134.google.com with SMTP id g15so560536ild.3 for ; Tue, 24 Jan 2023 17:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=fnjp1eDHjt6+cGvJs68s9H1CpSS37iDfyhMgmEeePKQ=; b=C4SgP8hAhgNY5y5KWAAD8/Ro0GZpQMIeg0gR1P+3y5xPavGD2I8nflliIgtKA9ubau OSZs5SrqhNVOxpUpIMsw6fELQlSX0ow1kIfDSjtBRI5lB7l8Nv4Y9JKTXiN8a95LLWse L3Qv7r8sBd9hUKqT/Kmz6++Hdwk/2r1OMqX2/A8iOhFUXaT+LWecw8BvjoySSNmdVK7/ Kaj3I88iQL5PgMOgNjnT5y+fv77c/E9wE9bDF1/POlUJuj0HuGXTsB2axPJhftcxsNKr qjuj567jlqRiT1uaMnQfgifU+FYJSY+v0gzd5eQCbKmPVBWwmJB7J4p9x73ORT97U69p YPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fnjp1eDHjt6+cGvJs68s9H1CpSS37iDfyhMgmEeePKQ=; b=FbDsIhMO4OhZDrCBXYSpiQKNVlhWOXidyTnx/A1llnMPBJThXhv0d1DMQuEAJehjcu Sg3+/1kiVZ/4gocb/AXUW973ZoUbYJqFufTCCueDEi3AM4D5oqcWS5PdhzjnozfWr9p8 b/5+fCQG1C9TyhnbCC3o8FlWW+HAJIicUPJeeDw/jDI94+DU3iDewCw/+/VTBFW9tXGX ZwNHtPuKPItZZKkOuTTSGVE7QXmk8DH0hFW+sI4OLZ8Ua+RxkPJUK5IRip1RJ9yDiORv ZCwyz9iePQnio69yciN/0dczRMFC85Y3TQneocpMsqB8SSXyT1nN//KYEDqB6wsr8WfW CmMQ== X-Gm-Message-State: AFqh2kpLEPw6CVwNC6NxmGQSvNTo4Yk8a1vDWDfWsvN9q+mND8fR4OE7 fP1kocREBv+J+QeEjY9kXZ5Kmg== X-Google-Smtp-Source: AMrXdXsfWHx2xdvSnfCyNegwXeCWVXaK+pTUslrBnPwlrs80ng/DbJBQ+dLcVL8YCwx+Vs6hfgw/OA== X-Received: by 2002:a05:6e02:52d:b0:30f:3a99:d417 with SMTP id h13-20020a056e02052d00b0030f3a99d417mr16131048ils.22.1674610651775; Tue, 24 Jan 2023 17:37:31 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a15-20020a02a00f000000b0038a48cfededsm1222140jah.15.2023.01.24.17.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 17:37:30 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 43748800A27; Tue, 24 Jan 2023 19:37:29 -0600 (CST) Date: Tue, 24 Jan 2023 19:37:29 -0600 From: Justin Pryzby To: Andres Freund Cc: Michael Paquier , Kyotaro Horiguchi , thomas.munro@gmail.com, tgl@sss.pgh.pa.us, john.naylor@enterprisedb.com, noriyoshi.shinoda@hpe.com, jchampion@timescale.com, sawada.mshk@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@postgresql.org, rjuju123@gmail.com Subject: Re: Improve logging when using Huge Pages Message-ID: <20230125013728.GK13860@telsasoft.com> References: <20221107151458.6puzamerxti2y5in@awork3.anarazel.de> <3239882.1667836576@sss.pgh.pa.us> <20221109.114757.661491395677294771.horikyota.ntt@gmail.com> <20230124012100.GB13860@telsasoft.com> <20230124013335.7u75j75ze5o7uh2l@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230124013335.7u75j75ze5o7uh2l@awork3.anarazel.de> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jan 23, 2023 at 05:33:35PM -0800, Andres Freund wrote: > Hi, > > On 2023-01-23 19:21:00 -0600, Justin Pryzby wrote: > > Michael seemed to support this idea and nobody verbalized hatred of it, > > so I implemented it. In v15, we have shared_memory_size_in_huge_pages, > > so this adds effective_huge_pages. > > > > Feel free to suggest a better name. > > Hm. Should this be a GUC? There's a reason shared_memory_size_in_huge_pages is > one - it's so it's accessible via -C. But here we could make it a function or > whatnot as well. I have no strong opinion, but a few minor arguments in favour of a GUC: - the implementation parallels huge_pages, huge_page_size, and shared_memory_size_in_huge_pages; - it's short; - it's glob()able with the others: postgres=# \dconfig *huge* List of configuration parameters Parameter | Value ----------------------------------+------- effective_huge_pages | off huge_pages | try huge_page_size | 0 shared_memory_size_in_huge_pages | 12 > I'm ok with this being a GUC, it doesn't feel elegant, but I suspect there's > no realistic elegant answer. BTW, I didn't realize it when I made the suggestion, nor when I wrote the patch, but a GUC was implemented in the v2 patch. https://www.postgresql.org/message-id/TU4PR8401MB1152CB4FEB99658BC6B35543EECF9%40TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM The original proposal was to change the elog(DEBUG1, "mmap..") to LOG, and the thread seems to have derailed out of concern for a hypothetical user who was adverse to an additional line of log messages during server start. I don't share that concern, but GUC or function seems better anyway, since the log message is not easily available (except maybe, sometimes, shortly after the server restart). I'm currently checking for huge pages in a nagios script by grepping /proc/pid/smaps (I *could* make use of a logfile if that was available, but it's better if it's a persistent state/variable). Whether it's a GUC or a function, I propose to name it hugepages_active. If there's no objections, I'll add to the CF. -- Justin