linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Merry <bmerry@ska.ac.za>
To: Linux MM <linux-mm@kvack.org>
Subject: Is MAP_POPULATE supposed to fail silently?
Date: Tue, 9 Mar 2021 11:33:13 +0200	[thread overview]
Message-ID: <CAOm-9aquXZUmt9kHeYCWUqgvgyphP7cf=z1DVX90PK=xqduoiQ@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-03-09  9:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  9:33 Bruce Merry [this message]
2021-03-09 10:32 ` David Hildenbrand
2021-03-09 11:10   ` Bruce Merry
2021-03-09 18:54     ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOm-9aquXZUmt9kHeYCWUqgvgyphP7cf=z1DVX90PK=xqduoiQ@mail.gmail.com' \
    --to=bmerry@ska.ac.za \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox