Memory allocation watchdog kernel thread.
Subsystems (6)
RFC PATCH 1/1 Memory allocation watchdog kernel thread.
Quoted 1 line
From
e07c200277cdb8e46aa754d3b980b02ab727cb80Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Sun, 18 Oct 2015 20:28:45 +0900
Subject: [PATCH] Memory allocation watchdog kernel thread.
This patch adds a kernel thread which periodically reports number of memory allocating tasks, dying tasks and OOM victim tasks when some task is spending too long time inside __alloc_pages_slowpath().
This kernel thread resembles khungtaskd kernel thread, but this kernel thread is for warning that memory allocation requests are stalling, in order to catch unexplained hangups/reboots caused by memory allocation stalls.
There are two types of memory allocation stalls, one is that we fail to solve OOM conditions after the OOM killer is invoked, the other is that we fail to solve OOM conditions before the OOM killer is invoked.
The former case is that the OOM killer chose an OOM victim but the chosen victim is unable to make forward progress. Although the OOM victim receives TIF_MEMDIE by the OOM killer, TIF_MEMDIE helps only if the OOM victim was doing memory allocation. That is, if the OOM victim was blocked at unkillable locks (e.g. mutex_lock(&inode->i_mutex) or down_read(&mm->mmap_sem)), the system will hang up upon global OOM condition. This kernel thread will report such situation by printing
MemAlloc-Info: $X stalling task, $Y dying task, $Z victim task.
line where $X > 0 and $Y > 0 and $Z > 0, followed by $X lines of
MemAlloc: $name($pid) gfp=$gfp order=$order delay=$delay
where $name and $pid are comm name and pid of a task which is stalling inside __alloc_pages_slowpath(), $gfp is the gfp flags used for that allocation request, $order is the order, delay is jiffies elapsed since entering into __alloc_pages_slowpath(), and $Y lines of
MemAlloc: $name($pid) $state_of_task
where $state_of_task is combination of "uninterruptible" (where that task is in uninterruptible sleep, likely due to uninterruptible lock), "dying" (where that task has pending SIGKILL, should be always included) and "victim" (where that task received TIF_MEMDIE, likely be only 1 task). In addition, stack trace of stalling tasks and dying tasks follows as with khungtaskd.
The latter case has two possibilities. One possibility is that all ongoing memory allocation requests are !__GFP_FS && !__GFP_NOFAIL, which does not invoke the OOM killer. The other possibility is that at least one task is doing __GFP_FS || __GFP_NOFAIL memory allocation request but operation for reclaiming memory is not working as expected due to unknown reason, which will not invoke the OOM killer. This kernel thread will report such situation by printing
MemAlloc-Info: $X stalling task, $Y dying task, 0 victim task.
line where $X > 0 and $Y >= 0, followed by $X lines of
MemAlloc: $name($pid) gfp=$gfp order=$order delay=$delay
and $Y lines of
MemAlloc: $name($pid) $state_of_task
followed by their stack traces.
An example of MemAlloc lines is shown below.
[ 212.372846] MemAlloc-Info: 4 stalling task, 9 dying task, 1 victim task. [ 212.374782] MemAlloc: oom-tester4(11516) gfp=0x242014a order=0 delay=10364 [ 212.376626] MemAlloc: systemd-journal(466) gfp=0x242014a order=0 delay=10359 [ 212.378505] MemAlloc: oom-tester4(11511) gfp=0x24280ca order=0 delay=10318 [ 212.380337] MemAlloc: vmtoolsd(1899) gfp=0x242014a order=0 delay=10317 [ 212.382182] MemAlloc: oom-tester4(11512) uninterruptible dying victim [ 212.383928] MemAlloc: oom-tester4(11514) uninterruptible dying [ 212.385551] MemAlloc: oom-tester4(11515) uninterruptible dying [ 212.387170] MemAlloc: oom-tester4(11516) dying [ 212.388516] MemAlloc: oom-tester4(11517) uninterruptible dying [ 212.390117] MemAlloc: oom-tester4(11519) uninterruptible dying [ 212.391817] MemAlloc: oom-tester4(11520) uninterruptible dying [ 212.393411] MemAlloc: oom-tester4(11521) uninterruptible dying [ 212.394997] MemAlloc: oom-tester4(11522) uninterruptible dying
Without this kernel thread, it is extremely hard to figure out that the system hung up due to memory allocation stalls because the "%s invoked oom-killer: gfp_mask=0x%x, order=%d, ""oom_score_adj=%hd\n" line is not printed for several corner cases in the former case and is never printed in the latter case, resulting in completely silent hangups.
--- mm/Kconfig | 25 +++++++ mm/page_alloc.c | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+)
mm/Kconfig +25 -0
@@ -668,3 +668,28 @@ config ZONE_DEVICE config FRAME_VECTOR bool + +config MEMALLOC_WATCHDOG + bool "Memory allocation stalling watchdog" + default n + help + This option emits warning messages and traces when memory + allocation requests are stalling, in order to catch unexplained + hangups/reboots caused by memory allocation stalls. + + Currently, when something went wrong inside memory allocation + request, the system will stall with either 100% CPU usage (if + memory allocating tasks are doing busy loop) or 0% CPU usage + (if memory allocating tasks are waiting for file data to be + flushed to storage). But /proc/sys/kernel/hung_task_warnings + is not helpful because memory allocating tasks do not sleep in + uninterruptible state for /proc/sys/kernel/hung_task_timeout_secs + seconds. + + Scan interval can be changed by passing integer value to kmallocwd + boot parameter. For example, passing kmallocwd=30 will emit first + stall warnings in between 30 and 60 seconds, and emit subsequent + warnings in 30 seconds. + + While performance penalty carried by using this option is small, + this option can be disabled by passing kmallocwd=0 boot parameter.
mm/page_alloc.c +209 -0
239 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC PATCH v2 1/1 Memory allocation watchdog kernel thread.
Quoted 1 line
From
ee98a42df32060fd08555dabbc3dd65ce9f1d643Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Sun, 22 Nov 2015 22:36:39 +0900
Subject: [PATCH v2] Memory allocation watchdog kernel thread.
This patch adds a kernel thread which periodically reports number of memory allocating tasks, dying tasks and OOM victim tasks when some task is spending too long time inside __alloc_pages_slowpath().
This kernel thread resembles khungtaskd kernel thread, but this kernel thread is for warning that memory allocation requests are stalling, in order to catch unexplained hangups/reboots caused by memory allocation stalls.
There are two types of memory allocation stalls, one is that we fail to solve OOM conditions after the OOM killer is invoked, the other is that we fail to solve OOM conditions before the OOM killer is invoked.
The former case is that the OOM killer chose an OOM victim but the chosen victim is unable to make forward progress. Although the OOM victim receives TIF_MEMDIE by the OOM killer, TIF_MEMDIE helps only if the OOM victim was doing memory allocation. That is, if the OOM victim was blocked at unkillable locks (e.g. mutex_lock(&inode->i_mutex) or down_read(&mm->mmap_sem)), the system will hang up upon global OOM condition. This kernel thread will report such situation by printing
MemAlloc-Info: $X stalling task, $Y dying task, $Z victim task.
line where $X > 0 and $Y > 0 and $Z > 0, followed by at most $X + $Y lines of
MemAlloc: $name($pid) $state_of_allocation $state_of_task
where $name and $pid are comm name and pid of a task.
$state_of_allocation is reported only when that task is stalling inside __alloc_pages_slowpath(), in gfp=$gfp order=$order delay=$delay format where $gfp is the gfp flags used for that allocation request, $order is the order, delay is jiffies elapsed since entering into __alloc_pages_slowpath().
$state_of_task is reported only when that task is dying, in combination of "uninterruptible" (where that task is in uninterruptible sleep, likely due to uninterruptible lock), "dying" (where that task has pending SIGKILL) and "victim" (where that task received TIF_MEMDIE, likely be only 1 task).
Then, stack trace of stalling tasks and dying tasks, and memory information (SysRq-m) follows.
The latter case has three possibilities. First possibility is simply overloaded (not a livelock but progress is too slow to wait). Second possibility is that at least one task is doing __GFP_FS || __GFP_NOFAIL memory allocation request but operation for reclaiming memory is not working as expected due to unknown reason (a livelock), which will not invoke the OOM killer. Third possibility is that all ongoing memory allocation requests are !__GFP_FS && !__GFP_NOFAIL, which does not invoke the OOM killer. This kernel thread will report such situation with $X > 0, $Y >= 0 and $Z = 0.
An example of MemAlloc lines is shown below.
[ 91.195737] MemAlloc-Info: 1 stalling task, 10 dying task, 1 victim task. [ 91.197936] MemAlloc: oom-tester4(11040) uninterruptible dying victim [ 91.199957] MemAlloc: oom-tester4(11042) uninterruptible dying [ 91.201833] MemAlloc: oom-tester4(11043) uninterruptible dying [ 91.203713] MemAlloc: oom-tester4(11044) uninterruptible dying [ 91.205569] MemAlloc: oom-tester4(11045) gfp=0x242014a order=0 delay=10000 dying [ 91.207733] MemAlloc: oom-tester4(11046) uninterruptible dying [ 91.209600] MemAlloc: oom-tester4(11047) uninterruptible dying [ 91.211473] MemAlloc: oom-tester4(11048) uninterruptible dying [ 91.213324] MemAlloc: oom-tester4(11049) uninterruptible dying [ 91.215186] MemAlloc: oom-tester4(11050) uninterruptible dying
[ 101.567609] MemAlloc-Info: 12 stalling task, 10 dying task, 1 victim task. [ 101.569551] MemAlloc: kworker/3:1(45) gfp=0x2400000 order=0 delay=19470 uninterruptible [ 101.571680] MemAlloc: systemd-journal(478) gfp=0x242014a order=0 delay=19538 uninterruptible [ 101.573871] MemAlloc: tuned(2081) gfp=0x242014a order=0 delay=19541 uninterruptible [ 101.575925] MemAlloc: irqbalance(1711) gfp=0x242014a order=0 delay=10685 [ 101.577850] MemAlloc: vmtoolsd(1908) gfp=0x242014a order=0 delay=19525 uninterruptible [ 101.579981] MemAlloc: master(4005) gfp=0x242014a order=0 delay=15090 uninterruptible [ 101.582113] MemAlloc: nmbd(4813) gfp=0x242014a order=0 delay=19533 uninterruptible [ 101.584267] MemAlloc: smbd(4967) gfp=0x242014a order=0 delay=11799 [ 101.586077] MemAlloc: smbd(5040) gfp=0x242014a order=0 delay=11441 [ 101.587873] MemAlloc: oom-tester4(11039) gfp=0x24280ca order=0 delay=19542 [ 101.589803] MemAlloc: oom-tester4(11040) uninterruptible dying victim [ 101.591637] MemAlloc: oom-tester4(11042) uninterruptible dying [ 101.593429] MemAlloc: oom-tester4(11043) uninterruptible dying [ 101.595122] MemAlloc: oom-tester4(11044) uninterruptible dying [ 101.596796] MemAlloc: oom-tester4(11045) gfp=0x242014a order=0 delay=20371 dying [ 101.598772] MemAlloc: oom-tester4(11046) uninterruptible dying [ 101.600527] MemAlloc: oom-tester4(11047) uninterruptible dying [ 101.602196] MemAlloc: oom-tester4(11048) uninterruptible dying [ 101.603851] MemAlloc: oom-tester4(11049) uninterruptible dying [ 101.605497] MemAlloc: oom-tester4(11050) uninterruptible dying [ 101.607139] MemAlloc: oom-tester4(11041) gfp=0x242014a order=0 delay=19541
Without this kernel thread, it is extremely hard to figure out that the system hung up due to memory allocation stalls because the "%s invoked oom-killer: gfp_mask=0x%x, order=%d, ""oom_score_adj=%hd\n" line is not printed for several corner cases in the former case and is never printed in the latter case, resulting in completely silent hangups.
Changes from V1: ( http://lkml.kernel.org/r/[email protected] )
(1) Use per a "struct task_struct" variables. This allows vmcore to remember information about last memory allocation request, which is useful for understanding last-minute behavior of the kernel.
(2) Report using accurate timeout. This increases possibility of successfully reporting before watchdog timers reset the machine.
(3) Show memory information (SysRq-m). This makes it easier to know the reason of stalling.
(4) Show both $state_of_allocation and $state_of_task in the same line. This makes it easier to grep the output.
(5) Minimize duration of spinlock held by the kernel thread.
--- include/linux/sched.h | 11 +++ mm/Kconfig | 24 ++++++ mm/page_alloc.c | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 251 insertions(+)
include/linux/sched.h +11 -0
@@ -1375,6 +1375,14 @@ struct tlbflush_unmap_batch {bool writable; }; +struct memalloc_info { +unsigned long start;/* Initialized to jiffies. */ +unsigned int order; +gfp_t gfp; +u8 valid;/* Takes one of 0, 1, 2. */ +u8 dumped; +}; +struct task_struct {volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */ void *stack;
@@ -1812,6 +1820,9 @@ struct task_struct {unsigned long task_state_change;#endif int pagefault_disabled; +#ifdef CONFIG_MEMALLOC_WATCHDOG +struct memalloc_info memalloc; +#endif /* CPU-specific state of this task */ struct thread_struct thread;/*
mm/Kconfig +24 -0
@@ -668,3 +668,27 @@ config ZONE_DEVICE config FRAME_VECTOR bool + +config MEMALLOC_WATCHDOG + bool "Memory allocation stalling watchdog" + default n + help + This option emits warning messages and traces when memory + allocation requests are stalling, in order to catch unexplained + hangups/reboots caused by memory allocation stalls. + + Currently, when something went wrong inside memory allocation + request, the system will stall with either 100% CPU usage (if + memory allocating tasks are doing busy loop) or 0% CPU usage + (if memory allocating tasks are waiting for file data to be + flushed to storage). But /proc/sys/kernel/hung_task_warnings + is not helpful because memory allocating tasks do not sleep in + uninterruptible state for /proc/sys/kernel/hung_task_timeout_secs + seconds. + + Scan interval can be changed by passing integer value to kmallocwd + boot parameter. For example, passing kmallocwd=30 will emit first + stall warnings in 30 seconds, and emit subsequent warnings in 30 + seconds. + + This option can be disabled by passing kmallocwd=0 boot parameter.
mm/page_alloc.c +216 -0
235 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 1 line
From
7cfea996b67a430000e7b0fb9943ebd799cf37e8Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Wed, 25 Nov 2015 00:16:24 +0900
Subject: [PATCH v3] Memory allocation watchdog kernel thread.
This patch adds a kernel thread which periodically reports number of memory allocating tasks, dying tasks and OOM victim tasks when some task is spending too long time inside __alloc_pages_slowpath().
Changes from v1:
(1) Use per a "struct task_struct" variables. This allows vmcore to remember information about last memory allocation request, which is useful for understanding last-minute behavior of the kernel.
(2) Report using accurate timeout. This increases possibility of successfully reporting before watchdog timers reset the machine.
(3) Show memory information (SysRq-m). This makes it easier to know the reason of stalling.
(4) Show both $state_of_allocation and $state_of_task in the same line. This makes it easier to grep the output.
(5) Minimize duration of spinlock held by the kernel thread.
Changes from v2:
(1) Print sequence number. This makes it easier to know whether memory allocation is succeeding (looks like a livelock but making forward progress) or not.
(2) Replace spinlock with cheaper seqlock_t like sequence number based method. The caller no longer contend on lock, and major overhead for caller side will be two smp_wmb() instead for read_lock()/read_unlock().
(3) Print "exiting" instead for "dying" if an OOM victim is stalling at do_exit(), for SIGKILL is removed before arriving at do_exit().
(4) Moved explanation to Documentation/malloc-watchdog.txt .
--- Documentation/malloc-watchdog.txt | 141 +++++++++++++++++++++++ include/linux/sched.h | 21 ++++ kernel/fork.c | 4 + mm/Kconfig | 10 ++ mm/page_alloc.c | 230 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 406 insertions(+) create mode 100644 Documentation/malloc-watchdog.txt
Documentation/malloc-watchdog.txt new file +141 -0
@@ -0,0 +1,141 @@ +========================================= +Memory allocation watchdog kernel thread. +========================================= + + +- What is it? + +This kernel thread resembles khungtaskd kernel thread, but this kernel +thread is for warning that memory allocation requests are stalling, in +order to catch unexplained hangups/reboots caused by memory allocation +stalls. + + +- Why need to use it? + +Currently, when something went wrong inside memory allocation request, +the system will stall with either 100% CPU usage (if memory allocating +tasks are doing busy loop) or 0% CPU usage (if memory allocating tasks +are waiting for file data to be flushed to storage). +But /proc/sys/kernel/hung_task_warnings is not helpful because memory +allocating tasks unlikely sleep in uninterruptible state for +/proc/sys/kernel/hung_task_timeout_secs seconds. + +People are reporting hang up problems. But we are forcing people to use +kernels without means to find out what was happening. The means are +expected to work without knowledge to use trace points functionality, +are expected to run without memory allocation, are expected to dump +output without administrator's operation, are expected to work before +watchdog timers reset the machine. + +Without this kernel thread, it is extremely hard to figure out that +the system hung up due to memory allocation stalls because the +"%s invoked oom-killer: gfp_mask=0x%x, order=%d, ""oom_score_adj=%hd\n" +line is not printed for several corner cases in the former case and is +never printed in the latter case, resulting in completely silent hangups. + + +- How to configure it? + +Build kernels with CONFIG_MEMALLOC_WATCHDOG=y. + +Default scan interval is 10 seconds. Scan interval can be changed by passing +integer value to kmallocwd boot parameter. For example, passing kmallocwd=30 +will emit first stall warnings in 30 seconds, and emit subsequent warnings in +30 seconds. + +Even if you disable this kernel thread by passing kmallocwd=0 boot parameter, +information about last memory allocation request is kept. That is, you will +get some hint for understanding last-minute behavior of the kernel when you +analyze vmcore (or memory snapshot of a virtualized machine). + + +- How memory allocation stalls are reported? + +There are two types of memory allocation stalls, one is that we fail to +solve OOM conditions after the OOM killer is invoked, the other is that +we fail to solve OOM conditions before the OOM killer is invoked. + +The former case is that the OOM killer chose an OOM victim but the chosen +victim is unable to make forward progress. Although the OOM victim +receives TIF_MEMDIE by the OOM killer, TIF_MEMDIE helps only if the OOM +victim was doing memory allocation. That is, if the OOM victim was +blocked at unkillable locks (e.g. mutex_lock(&inode->i_mutex) or +down_read(&mm->mmap_sem)), the system will hang up upon global OOM +condition. This kernel thread will report such situation by printing + + MemAlloc-Info: $X stalling task, $Y dying task, $Z victim task. + +line where $X > 0 and $Y > 0 and $Z > 0, followed by at most $X + $Y +lines of + + MemAlloc: $name($pid) $state_of_allocation $state_of_task + +where $name and $pid are comm name and pid of a task. + +$state_of_allocation is reported only when that task is stalling inside +__alloc_pages_slowpath(), in seq=$seq gfp=$gfp order=$order delay=$delay +format where $seq is the sequence number for allocation request, $gfp is +the gfp flags used for that allocation request, $order is the order, +delay is jiffies elapsed since entering into __alloc_pages_slowpath(). + +$state_of_task is reported only when that task is dying, in combination +of "uninterruptible" (where that task is in uninterruptible sleep, +likely due to uninterruptible lock), "exiting" (where that task arrived +at do_exit() function), "dying" (where that task has pending SIGKILL) +and "victim" (where that task received TIF_MEMDIE, likely be only 1 task). + +The latter case has three possibilities. First possibility is simply +overloaded (not a livelock but progress is too slow to wait). You can +check for seq=$seq field for each reported process. If $seq is +increasing over time, it is not a livelock. Second possibility is that +at least one task is doing __GFP_FS || __GFP_NOFAIL memory allocation +request but operation for reclaiming memory is not working as expected +due to unknown reason (a livelock), which will not invoke the OOM +killer. Third possibility is that all ongoing memory allocation +requests are !__GFP_FS && !__GFP_NOFAIL, which does not invoke the OOM +killer. This kernel thread will report such situation with $X > 0, +$Y >= 0 and $Z = 0. + + +- How the messages look like? + +An example of MemAlloc lines is shown below. Stack trace of stalling tasks and +dying tasks, and memory information (SysRq-m) will follow the MemAlloc lines. +You can use serial console and/or netconsole to save these messages when the +system is stalling. + + [ 95.444132] MemAlloc-Info: 1 stalling task, 9 dying task, 1 victim task. + [ 95.446356] MemAlloc: oom-tester(11043) uninterruptible exiting victim + [ 95.448535] MemAlloc: oom-tester(11045) dying + [ 95.450270] MemAlloc: oom-tester(11046) dying + [ 95.452160] MemAlloc: oom-tester(11047) uninterruptible dying + [ 95.454220] MemAlloc: oom-tester(11048) dying + [ 95.455933] MemAlloc: oom-tester(11049) uninterruptible dying + [ 95.457901] MemAlloc: oom-tester(11050) uninterruptible dying + [ 95.459849] MemAlloc: oom-tester(11051) uninterruptible dying + [ 95.461793] MemAlloc: oom-tester(11052) seq=2 gfp=0x242014a order=0 delay=10002 dying + [ 95.464165] MemAlloc: oom-tester(11053) dying + + [ 105.879267] MemAlloc-Info: 16 stalling task, 9 dying task, 1 victim task. + [ 105.881314] MemAlloc: kworker/1:2(407) seq=1 gfp=0x2400000 order=0 delay=18966 + [ 105.883360] MemAlloc: systemd-journal(477) seq=1227 gfp=0x242014a order=0 delay=19999 + [ 105.885514] MemAlloc: tuned(2081) seq=789 gfp=0x242014a order=0 delay=12001 + [ 105.887515] MemAlloc: irqbalance(743) seq=2 gfp=0x242014a order=0 delay=15882 + [ 105.889554] MemAlloc: rngd(744) seq=61 gfp=0x242014a order=0 delay=20000 + [ 105.891573] MemAlloc: abrt-watch-log(757) seq=4 gfp=0x242014a order=0 delay=20013 + [ 105.893696] MemAlloc: vmtoolsd(1905) seq=1512 gfp=0x242014a order=0 delay=20014 + [ 105.895873] MemAlloc: nmbd(4784) seq=2 gfp=0x242014a order=0 delay=15034 + [ 105.897872] MemAlloc: smbd(4949) seq=2 gfp=0x242014a order=0 delay=16070 + [ 105.899835] MemAlloc: smbd(5020) seq=2 gfp=0x242014a order=0 delay=15632 + [ 105.901782] MemAlloc: oom-tester(11042) seq=4974 gfp=0x24280ca order=0 delay=20015 + [ 105.903887] MemAlloc: oom-tester(11043) uninterruptible exiting victim + [ 105.905797] MemAlloc: oom-tester(11045) seq=2 gfp=0x242014a order=0 delay=20419 dying + [ 105.908024] MemAlloc: oom-tester(11046) seq=4 gfp=0x242014a order=0 delay=20011 dying + [ 105.910161] MemAlloc: oom-tester(11047) uninterruptible dying + [ 105.911910] MemAlloc: oom-tester(11048) seq=4 gfp=0x242014a order=0 delay=20004 dying + [ 105.914044] MemAlloc: oom-tester(11049) uninterruptible dying + [ 105.915780] MemAlloc: oom-tester(11050) uninterruptible dying + [ 105.917518] MemAlloc: oom-tester(11051) uninterruptible dying + [ 105.919249] MemAlloc: oom-tester(11052) seq=2 gfp=0x242014a order=0 delay=20437 dying + [ 105.921362] MemAlloc: oom-tester(11053) seq=2 gfp=0x242014a order=0 delay=20402 dying
include/linux/sched.h +21 -0
@@ -1375,6 +1375,24 @@ struct tlbflush_unmap_batch {bool writable; }; +struct memalloc_info { +/* For locking and progress monitoring. */ +unsigned int sequence; +/* +* 0: not doing __GFP_RECLAIM allocation. +* 1: doing non-recursive __GFP_RECLAIM allocation. +* 2: doing recursive __GFP_RECLAIM allocation. +*/ +u8 valid; +/* For reducing stack traces. */ +u8 dumped; +/* Started time in jiffies as of valid == 1. */ +unsigned long start; +/* Requested order and gfp flags as of valid == 1. */ +unsigned int order; +gfp_t gfp; +}; +struct task_struct {volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */ void *stack;
@@ -1812,6 +1830,9 @@ struct task_struct {unsigned long task_state_change;#endif int pagefault_disabled; +#ifdef CONFIG_MEMALLOC_WATCHDOG +struct memalloc_info memalloc; +#endif /* CPU-specific state of this task */ struct thread_struct thread;/*
kernel/fork.c +4 -0
@@ -1416,6 +1416,10 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->sequential_io_avg =0 ;#endif +#ifdef CONFIG_MEMALLOC_WATCHDOG + p->memalloc.sequence =0 ; +#endif +/* Perform scheduler related setup. Assign this task to a CPU. */ retval =sched_fork (clone_flags, p);if (retval)
mm/Kconfig +10 -0
@@ -668,3 +668,13 @@ config ZONE_DEVICE config FRAME_VECTOR bool + +config MEMALLOC_WATCHDOG + bool "Memory allocation stalling watchdog" + default n + help + This option emits warning messages and traces when memory + allocation requests are stalling, in order to catch unexplained + hangups/reboots caused by memory allocation stalls. + + See Documentation/malloc-watchdog.txt for more information.
mm/page_alloc.c +230 -0
249 lines not on this page · raw message
Signature · 1 line
1.8.3.1