linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Is MAP_POPULATE supposed to fail silently?
@ 2021-03-09  9:33 Bruce Merry
  2021-03-09 10:32 ` David Hildenbrand
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Merry @ 2021-03-09  9:33 UTC (permalink / raw)
  To: Linux MM

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Hi

I've run into a problem with using mmap(..., MAP_ANONYMOUS | MAP_POPULATE |
MAP_HUGETLB). If there are no huge pages available due to vm.nr_hugepages
(or hugetlb.2MB.rsvd.limit_in_bytes cgroup setting) then the mmap call
fails and I can gracefully fall back to 4KB pages. However, if neither of
the above apply but hugetlb.2MB.limit_in_bytes prevents pages being mapped,
then it appears that MAP_POPULATE is silently ignored (according to
mincore), and rather than being able to gracefully fall back, attempting to
use the memory results in SIGBUS.

Is that expected behaviour? I don't see anything in the mmap(2) man page
about it being best-effort (in contrast to MAP_LOCKED, which explicitly
says the call won't fail if it can't lock the memory).

This is on Linux 5.8 on Ubuntu 20.04. I can provide sample code if it's of
interest, or test on a newer kernel if it'll help.

Thanks
Bruce
-- 
Bruce Merry
Senior Science Processing Developer
SARAO

[-- Attachment #2: Type: text/html, Size: 1301 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-09 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  9:33 Is MAP_POPULATE supposed to fail silently? Bruce Merry
2021-03-09 10:32 ` David Hildenbrand
2021-03-09 11:10   ` Bruce Merry
2021-03-09 18:54     ` Mike Kravetz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox