Is MAP_POPULATE supposed to fail silently?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux