lkml.org 
[lkml]   [2019]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [RFC PATCH] mm, oom: disable dump_tasks by default
From
Date
On 2019/09/05 23:08, Michal Hocko wrote:
> On Thu 05-09-19 22:39:47, Tetsuo Handa wrote:
> [...]
>> There is nothing that prevents users from enabling oom_dump_tasks by sysctl.
>> But that requires a solution for OOM stalling problem.
>
> You can hardly remove stalling if you are not reducing the amount of
> output or get it into a different context. Whether the later is
> reasonable is another question but you are essentially losing "at the
> OOM event state".
>

I am not losing "at the OOM event state". Please find "struct oom_task_info"
(for now) embedded into "struct task_struct" which holds "at the OOM event state".

And my patch moves "printk() from dump_tasks()" from OOM context to WQ context.
Thus, I do remove stalling by defer printing of "struct oom_task_info" until
the OOM killer sends SIGKILL and the OOM reaper starts reclaiming memory.

--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -639,6 +639,21 @@ struct wake_q_node {
struct wake_q_node *next;
};

+/* Memory usage and misc info as of invocation of OOM killer. */
+struct oom_task_info {
+ struct list_head list;
+ unsigned int seq;
+ char comm[TASK_COMM_LEN];
+ pid_t pid;
+ uid_t uid;
+ pid_t tgid;
+ unsigned long total_vm;
+ unsigned long mm_rss;
+ unsigned long pgtables_bytes;
+ unsigned long swapents;
+ int score_adj;
+};
+
struct task_struct {
#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
@@ -1260,7 +1275,7 @@ struct task_struct {
#ifdef CONFIG_MMU
struct task_struct *oom_reaper_list;
#endif
- struct list_head oom_victim_list;
+ struct oom_task_info oom_task_info;
#ifdef CONFIG_VMAP_STACK
struct vm_struct *stack_vm_area;
#endif
\
 
 \ /
  Last update: 2019-09-06 12:46    [W:0.061 / U:1.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site