This is an user visible API so let's CC linux-api mailing list.
On Mon 26-06-17 12:46:13, Prakash Sangappa wrote:
In some cases, userfaultfd mechanism should just deliver a SIGBUS signalthis is rather confusing. What is the reason that the monitor would be
to the faulting process, instead of the page-fault event. Dealing with
page-fault event using a monitor thread can be an overhead in these
cases. For example applications like the database could use the signaling
mechanism for robustness purpose.
slower than signal delivery and handling?
Database uses hugetlbfs for performance reason. Files on hugetlbfsSo you register UFFD_FEATURE_SIGBUS on each region tha you are unmapping
filesystem are created and huge pages allocated using fallocate() API.
Pages are deallocated/freed using fallocate() hole punching support.
These files are mmapped and accessed by many processes as shared memory.
The database keeps track of which offsets in the hugetlbfs file have
pages allocated.
Any access to mapped address over holes in the file, which can occur due
to bugs in the application, is considered invalid and expect the process
to simply receive a SIGBUS. However, currently when a hole in the file is
accessed via the mapped address, kernel/mm attempts to automatically
allocate a page at page fault time, resulting in implicitly filling the
hole in the file. This may not be the desired behavior for applications
like the database that want to explicitly manage page allocations of
hugetlbfs files.
and than just let those offenders die?
Using userfaultfd mechanism, with this support to get a signal, databasePlease make those requirements part of the changelog.
application can prevent pages from being allocated implicitly when
processes access mapped address over holes in the file.
This patch adds the feature to request for a SIGBUS signal to userfaultfd
mechanism.
See following for previous discussion about the database requirement
leading to this proposal as suggested by Andrea.
http://www.spinics.net/lists/linux-mm/msg129224.html