linux-stable/include/linux/sched
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
..
autogroup.h sched/headers: Remove <linux/sched.h> from <linux/sched/autogroup.h> 2017-03-03 01:45:29 +01:00
clock.h sched/clock: Use late_initcall() instead of sched_init_smp() 2017-05-15 10:15:21 +02:00
coredump.h mm: make PR_SET_THP_DISABLE immediately active 2017-07-10 16:32:31 -07:00
cpufreq.h sched/headers: Remove <linux/sched.h> from <linux/sched/cpufreq.h> 2017-03-03 01:45:32 +01:00
cputime.h sched/headers: Move cputime functionality from <linux/sched.h> and <linux/cputime.h> into <linux/sched/cputime.h> 2017-03-03 01:45:22 +01:00
deadline.h
debug.h sched/headers: Remove <linux/sched.h> from <linux/sched/debug.h> 2017-03-03 01:45:35 +01:00
hotplug.h sched/headers: Remove <linux/sched.h> from <linux/sched/hotplug.h> 2017-03-03 01:45:35 +01:00
idle.h sched/headers: Remove tsk_is_polling() 2017-03-03 01:45:27 +01:00
init.h sched/headers: Remove <linux/sched.h> from <linux/sched/init.h> 2017-03-03 01:45:38 +01:00
jobctl.h sched/headers: Move the JOBCTL_ defines and methods from <linux/sched.h> to <linux/sched/jobctl.h> 2017-03-03 01:43:41 +01:00
loadavg.h sched/headers: Remove <linux/sched.h> from <linux/sched/loadavg.h> 2017-03-03 01:45:28 +01:00
mm.h mm: introduce memalloc_noreclaim_{save,restore} 2017-05-08 17:15:15 -07:00
nohz.h MAINTAINERS: Add Frederic Weisbecker as nohz/dyntics maintainer 2017-07-05 16:26:37 +02:00
numa_balancing.h sched/headers: Move the NUMA balancing interfaces from <linux/sched.h> to <linux/sched/numa_balancing.h> 2017-03-03 01:43:40 +01:00
prio.h
rt.h sched/rtmutex: Refactor rt_mutex_setprio() 2017-04-04 11:44:06 +02:00
signal.h signal: Make kill_proc_info static 2017-04-21 22:46:25 -05:00
stat.h sched/headers: Remove <linux/sched.h> from <linux/sched/stat.h> 2017-03-03 01:45:34 +01:00
sysctl.h
task.h Merge branch 'work.sys_wait' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-05 14:10:19 -07:00
task_stack.h sched/headers: Move kstack_end() from <linux/sched.h> to <linux/sched/task_stack.h> 2017-03-03 01:45:24 +01:00
topology.h sched/headers: Remove the <linux/topology.h> include from <linux/sched.h> 2017-03-03 01:45:41 +01:00
user.h sched/headers: Remove <linux/sched.h> from <linux/sched/user.h> 2017-03-03 01:45:30 +01:00
wake_q.h sched/headers: Move the wake-queue types and interfaces from sched.h into <linux/sched/wake_q.h> 2017-03-02 08:42:42 +01:00
xacct.h sched/headers: Move CONFIG_TASK_XACCT bits from <linux/sched.h> to <linux/sched/xacct.h> 2017-03-03 01:43:41 +01:00