mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
mm/compaction: Disable compact_unevictable_allowed on RT
Since commit 5bbe3547aa
("mm: allow compaction of unevictable pages")
it is allowed to examine mlocked pages and compact them by default. On
-RT even minor pagefaults are problematic because it may take a few 100us
to resolve them and until then the task is blocked.
Make compact_unevictable_allowed = 0 default and issue a warning on RT if
it is changed.
[bigeasy@linutronix.de: v5]
Link: https://lore.kernel.org/linux-mm/20190710144138.qyn4tuttdq6h7kqx@linutronix.de/
Link: http://lkml.kernel.org/r/20200319165536.ovi75tsr2seared4@linutronix.de
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/linux-mm/20190710144138.qyn4tuttdq6h7kqx@linutronix.de/
Link: http://lkml.kernel.org/r/20200303202225.nhqc3v5gwlb7x6et@linutronix.de
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
964b692daf
commit
6923aa0d8c
3 changed files with 35 additions and 1 deletions
|
@ -128,6 +128,9 @@ allowed to examine the unevictable lru (mlocked pages) for pages to compact.
|
||||||
This should be used on systems where stalls for minor page faults are an
|
This should be used on systems where stalls for minor page faults are an
|
||||||
acceptable trade for large contiguous free memory. Set to 0 to prevent
|
acceptable trade for large contiguous free memory. Set to 0 to prevent
|
||||||
compaction from moving pages that are unevictable. Default value is 1.
|
compaction from moving pages that are unevictable. Default value is 1.
|
||||||
|
On CONFIG_PREEMPT_RT the default value is 0 in order to avoid a page fault, due
|
||||||
|
to compaction, which would block the task from becomming active until the fault
|
||||||
|
is resolved.
|
||||||
|
|
||||||
|
|
||||||
dirty_background_bytes
|
dirty_background_bytes
|
||||||
|
|
|
@ -212,6 +212,11 @@ static int proc_do_cad_pid(struct ctl_table *table, int write,
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos);
|
void __user *buffer, size_t *lenp, loff_t *ppos);
|
||||||
static int proc_taint(struct ctl_table *table, int write,
|
static int proc_taint(struct ctl_table *table, int write,
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos);
|
void __user *buffer, size_t *lenp, loff_t *ppos);
|
||||||
|
#ifdef CONFIG_COMPACTION
|
||||||
|
static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
|
||||||
|
int write, void __user *buffer,
|
||||||
|
size_t *lenp, loff_t *ppos);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PRINTK
|
#ifdef CONFIG_PRINTK
|
||||||
|
@ -1467,7 +1472,7 @@ static struct ctl_table vm_table[] = {
|
||||||
.data = &sysctl_compact_unevictable_allowed,
|
.data = &sysctl_compact_unevictable_allowed,
|
||||||
.maxlen = sizeof(int),
|
.maxlen = sizeof(int),
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_dointvec_minmax,
|
.proc_handler = proc_dointvec_minmax_warn_RT_change,
|
||||||
.extra1 = SYSCTL_ZERO,
|
.extra1 = SYSCTL_ZERO,
|
||||||
.extra2 = SYSCTL_ONE,
|
.extra2 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
|
@ -2555,6 +2560,28 @@ int proc_dointvec(struct ctl_table *table, int write,
|
||||||
return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
|
return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_COMPACTION
|
||||||
|
static int proc_dointvec_minmax_warn_RT_change(struct ctl_table *table,
|
||||||
|
int write, void __user *buffer,
|
||||||
|
size_t *lenp, loff_t *ppos)
|
||||||
|
{
|
||||||
|
int ret, old;
|
||||||
|
|
||||||
|
if (!IS_ENABLED(CONFIG_PREEMPT_RT) || !write)
|
||||||
|
return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
||||||
|
|
||||||
|
old = *(int *)table->data;
|
||||||
|
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
if (old != *(int *)table->data)
|
||||||
|
pr_warn_once("sysctl attribute %s changed by %s[%d]\n",
|
||||||
|
table->procname, current->comm,
|
||||||
|
task_pid_nr(current));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* proc_douintvec - read a vector of unsigned integers
|
* proc_douintvec - read a vector of unsigned integers
|
||||||
* @table: the sysctl table
|
* @table: the sysctl table
|
||||||
|
|
|
@ -1594,7 +1594,11 @@ typedef enum {
|
||||||
* Allow userspace to control policy on scanning the unevictable LRU for
|
* Allow userspace to control policy on scanning the unevictable LRU for
|
||||||
* compactable pages.
|
* compactable pages.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_PREEMPT_RT
|
||||||
|
int sysctl_compact_unevictable_allowed __read_mostly = 0;
|
||||||
|
#else
|
||||||
int sysctl_compact_unevictable_allowed __read_mostly = 1;
|
int sysctl_compact_unevictable_allowed __read_mostly = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
update_fast_start_pfn(struct compact_control *cc, unsigned long pfn)
|
update_fast_start_pfn(struct compact_control *cc, unsigned long pfn)
|
||||||
|
|
Loading…
Reference in a new issue