Re: Supporting huge pages on Windows

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supporting huge pages on Windows
Date: 2017-01-30 01:46:04
Message-ID: 0A3221C70F24FB45833433255569204D1F68BED6@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Amit Kapila [mailto:amit(dot)kapila16(at)gmail(dot)com]
> Hmm. It doesn't work even on a command prompt with administrative
> privileges. It gives below error:
>
> waiting for server to start....2017-01-17 11:20:13.780 IST [4788] FATAL:
> could not create shared memory segment: error code 1450
> 2017-01-17 11:20:13.780 IST [4788] DETAIL: Failed system call was
> CreateFileMap ping(size=148897792,
> name=Global/PostgreSQL:E:/WorkSpace/PostgreSQL/master/Data)
> .
> 2017-01-17 11:20:13.780 IST [4788] LOG: database system is shut down
> stopped waiting
> pg_ctl: could not start server
> Examine the log output.
>
>
> Now, error code 1450 can occur due to insufficient system resources, so
> I have tried by increasing the size of shared memory (higher value of
> shared_buffers) without your patch and it works. This indicates some
> problem with the patch.

Hmm, the large-page requires contiguous memory for each page, so this error could occur on a long-running system where the memory is heavily fragmented. For example, please see the following page and check the memory with RAMMap program referred there.

http://blog.dbi-services.com/large-pages-and-memory_target-on-windows/

BTW, is your OS or PostgreSQL 32-bit?

> > It seems that Windows removes many privileges, including "Lock Pages
> in Memory", when starting the normal command prompt. As its evidence, you
> can use the attached priv.c to see what privileges are assigned and and
> enabled/disabled. Build it like "cl priv.c" and just run priv.exe on each
> command prompt. Those runs show different privileges.
> >
>
> This is bad.
>
> > Should I need to do something, e.g. explain in the document that the user
> should use the command prompt with administrative privileges when he uses
> huge_pages?
> >
>
> I think it is better to document in some way if we decide to go-ahead with
> the patch.

Sure, I added these sentences.

+ To start the database server on the command prompt as a standalone process,
+ not as a Windows service, run the command prompt as an administrator or
+ disable the User Access Control (UAC). When the UAC is enabled, the normal
+ command prompt revokes the user right Lock Pages in Memory.

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
win_large_pages_v7.patch application/octet-stream 7.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2017-01-30 02:20:30 Re: pg_hba_file_settings view patch
Previous Message vinayak 2017-01-30 01:20:27 Re: Transactions involving multiple postgres foreign servers