Improve logging when using Huge Pages

Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>

From: "Shinoda, Noriyoshi (PN Japan FSIP)" <noriyoshi.shinoda@hpe.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-08-31T05:36:47Z
Lists: pgsql-hackers

Attachments

Hi Hackers,

In the current version, when GUC huge_pages=try, which is the default setting, no log is output regardless of the success or failure of the HugePages acquisition. If you want to output logs, you need to set log_min_messages=DEBUG3, but it will output a huge amount of extra logs.
With huge_pages=try setting, if the kernel parameter vm.nr_hugepages is not enough, the administrator will not notice that HugePages is not being used.
I think it should output a log if HugePages was not available.

By the way, in MySQL with almost the same architecture, the following log is output at the Warning level.

[Warning] [MY-012677] [InnoDB] Failed to allocate 138412032 bytes. errno 1
[Warning] [MY-012679] [InnoDB] Using conventional memory pool

The attached small patch outputs a log at the WARNING level when huge_pages = try and if the acquisition of HugePages fails.

Regards, 
Noriyoshi Shinoda

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add GUC parameter "huge_pages_status"

  2. Add check on initial and boot values when loading GUCs

  3. Clean up some inconsistencies with GUC declarations

  4. Clean up some GUC declarations and comments