linux/include
Prakash Sangappa 2d6d6f5a09 mm: userfaultfd: add feature to request for a signal delivery
In some cases, userfaultfd mechanism should just deliver a SIGBUS signal
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.

Database uses hugetlbfs for performance reason.  Files on hugetlbfs
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.

Using userfaultfd mechanism with this support to get a signal, database
application can prevent pages from being allocated implicitly when
processes access mapped address over holes in the file.

This patch adds UFFD_FEATURE_SIGBUS feature to userfaultfd mechnism to
request for a SIGBUS signal.

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

Link: http://lkml.kernel.org/r/1501552446-748335-2-git-send-email-prakash.sangappa@oracle.com
Signed-off-by: Prakash Sangappa <prakash.sangappa@oracle.com>
Reviewed-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-09-06 17:27:29 -07:00
..
acpi Device properties framework updates for v4.14-rc1 2017-09-05 12:50:00 -07:00
asm-generic Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 12:21:28 -07:00
clocksource
crypto
drm drm/syncobj: Add a callback mechanism for replace_fence (v3) 2017-08-29 06:26:42 +10:00
dt-bindings pinctrl: qcom: spmi-gpio: Add support for GPIO LV/MV subtype 2017-08-15 11:16:36 +02:00
keys
kvm
linux mm: rename global_page_state to global_zone_page_state 2017-09-06 17:27:29 -07:00
math-emu
media Linux 4.13-rc5 2017-08-15 16:16:58 +10:00
memory
misc
net ipv6: fix sparse warning on rt6i_node 2017-08-28 15:34:40 -07:00
pcmcia
ras
rdma IB/core: Assign root to all drivers 2017-08-31 08:35:14 -04:00
rxrpc
scsi SCSI fixes on 20170823 2017-08-23 11:34:40 -07:00
soc
sound drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio 2017-08-16 12:52:41 +03:00
target
trace dax: use common 4k zero page for dax mmap reads 2017-09-06 17:27:24 -07:00
uapi mm: userfaultfd: add feature to request for a signal delivery 2017-09-06 17:27:29 -07:00
video
xen