Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-13 Thread Tom Lane
Andres Freund writes: > On 2016-10-12 16:33:38 -0400, Tom Lane wrote: >> Also, if you look into /sys then you are going to see multiple >> possible values and it's not clear how to choose the right one. > That's a fair point. It'd probably be good to use the largest we can, >

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Merlin Moncure
On Wed, Oct 12, 2016 at 5:18 PM, Tom Lane wrote: > Merlin Moncure writes: >> ISTM all this silliness is pretty much unique to linux anyways. >> Instead of reading the filesystem, what about doing test map and test >> unmap? > > And if mmap succeeds and

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Andres Freund
On 2016-10-12 16:33:38 -0400, Tom Lane wrote: > Andres Freund writes: > > On October 12, 2016 1:25:54 PM PDT, Tom Lane wrote: > >> A little bit of research suggests that on Linux the thing to do would > >> be to get the actual default hugepage size by

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Tom Lane
Merlin Moncure writes: > ISTM all this silliness is pretty much unique to linux anyways. > Instead of reading the filesystem, what about doing test map and test > unmap? And if mmap succeeds and munmap fails, you'll recover how exactly? If this API were less badly designed,

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Merlin Moncure
On Wed, Oct 12, 2016 at 5:10 PM, Tom Lane wrote: > Alvaro Herrera writes: >> Tom Lane wrote: >>> According to >>> https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt >>> looking into /proc/meminfo is the longer-standing API and thus is >>>

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> According to >> https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt >> looking into /proc/meminfo is the longer-standing API and thus is >> likely to work on more kernel versions. Also, if you look into >> /sys then

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Alvaro Herrera
Tom Lane wrote: > Andres Freund writes: > > On October 12, 2016 1:25:54 PM PDT, Tom Lane wrote: > >> A little bit of research suggests that on Linux the thing to do would > >> be to get the actual default hugepage size by reading /proc/meminfo and > >>

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Tom Lane
Andres Freund writes: > On October 12, 2016 1:25:54 PM PDT, Tom Lane wrote: >> A little bit of research suggests that on Linux the thing to do would >> be to get the actual default hugepage size by reading /proc/meminfo and >> looking for a line like

Re: [HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Andres Freund
On October 12, 2016 1:25:54 PM PDT, Tom Lane wrote: >If any of you were following the thread at >https://www.postgresql.org/message-id/flat/CAOan6TnQeSGcu_627NXQ2Z%2BWyhUzBjhERBm5RN9D0QFWmk7PoQ%40mail.gmail.com >I spent quite a bit of time following a bogus theory, but the

[HACKERS] munmap() failure due to sloppy handling of hugepage size

2016-10-12 Thread Tom Lane
If any of you were following the thread at https://www.postgresql.org/message-id/flat/CAOan6TnQeSGcu_627NXQ2Z%2BWyhUzBjhERBm5RN9D0QFWmk7PoQ%40mail.gmail.com I spent quite a bit of time following a bogus theory, but the problem turns out to be very simple: on Linux, munmap() is pickier than mmap()