linux-stable/include
Michal Hocko 1860033237 mm: make PR_SET_THP_DISABLE immediately active
PR_SET_THP_DISABLE has a rather subtle semantic.  It doesn't affect any
existing mapping because it only updated mm->def_flags which is a
template for new mappings.

The mappings created after prctl(PR_SET_THP_DISABLE) have VM_NOHUGEPAGE
flag set.  This can be quite surprising for all those applications which
do not do prctl(); fork() & exec() and want to control their own THP
behavior.

Another usecase when the immediate semantic of the prctl might be useful
is a combination of pre- and post-copy migration of containers with
CRIU.  In this case CRIU populates a part of a memory region with data
that was saved during the pre-copy stage.  Afterwards, the region is
registered with userfaultfd and CRIU expects to get page faults for the
parts of the region that were not yet populated.  However, khugepaged
collapses the pages and the expected page faults do not occur.

In more general case, the prctl(PR_SET_THP_DISABLE) could be used as a
temporary mechanism for enabling/disabling THP process wide.

Implementation wise, a new MMF_DISABLE_THP flag is added.  This flag is
tested when decision whether to use huge pages is taken either during
page fault of at the time of THP collapse.

It should be noted, that the new implementation makes PR_SET_THP_DISABLE
master override to any per-VMA setting, which was not the case
previously.

Fixes: a0715cc226 ("mm, thp: add VM_INIT_DEF_MASK and PRCTL_THP_DISABLE")
Link: http://lkml.kernel.org/r/1496415802-30944-1-git-send-email-rppt@linux.vnet.ibm.com
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-10 16:32:31 -07:00
..
acpi arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
asm-generic powerpc updates for 4.13 2017-07-07 13:55:45 -07:00
clocksource
crypto
drm main drm pull for v4.13 2017-07-09 18:48:37 -07:00
dt-bindings This is the bulk of GPIO changes for the v4.13 series: 2017-07-07 12:40:27 -07:00
keys
kvm
linux mm: make PR_SET_THP_DISABLE immediately active 2017-07-10 16:32:31 -07:00
math-emu
media main drm pull for v4.13 2017-07-09 18:48:37 -07:00
memory
misc cxl: Export library to support IBM XSL 2017-07-03 23:07:03 +10:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-07-08 12:01:22 -07:00
pcmcia
ras trace, ras: add ARM processor error trace event 2017-06-22 18:22:05 +01:00
rdma Fixes #3 for 4.12-rc 2017-07-06 11:45:08 -07:00
rxrpc
scsi SCSI misc on 20170704 2017-07-06 12:10:33 -07:00
soc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
sound ASoC: Updates for v4.13 2017-07-03 19:51:42 +02:00
target
trace Writeback error handling fixes (pile #2) 2017-07-07 19:38:17 -07:00
uapi main drm pull for v4.13 2017-07-09 18:48:37 -07:00
video
xen This is the first pull request for the new dma-mapping subsystem 2017-07-06 19:20:54 -07:00