* [PATCH] oom: add tracepoints for oom_score_adj
@ 2011-12-07 0:54 KAMEZAWA Hiroyuki
2011-12-07 1:22 ` David Rientjes
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-07 0:54 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, akpm, rientjes, dchinner
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-07 0:54 [PATCH] oom: add tracepoints for oom_score_adj KAMEZAWA Hiroyuki
@ 2011-12-07 1:22 ` David Rientjes
2011-12-07 1:27 ` KAMEZAWA Hiroyuki
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: David Rientjes @ 2011-12-07 1:22 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, akpm, dchinner
On Wed, 7 Dec 2011, KAMEZAWA Hiroyuki wrote:
> From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 7 Dec 2011 09:58:16 +0900
> Subject: [PATCH] oom: trace point for oom_score_adj
>
> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> Some daemons sets this value and their children inerit it sometimes.
> Because inheritance of oom_score_adj is done automatically, users
> can be confused at seeing the value and finds it's hard to debug.
>
> This patch adds trace point for oom_score_adj. This adds 3 trace
> points. at
> - update oom_score_adj
> - fork()
> - rename task->comm(typically, exec())
>
> Outputs will be following.
> bash-2404 [006] 199.620841: oom_score_adj_update: task 2404[bash] updates oom_score_ad j=-1000
> bash-2404 [006] 205.861287: oom_score_adj_inherited: new_task=2442 oom_score_adj=-1000
> su-2442 [003] 205.861761: oom_score_task_rename: rename task 2442[bash] to [su] oom_ score_adj=-1000
> su-2442 [003] 205.866737: oom_score_adj_inherited: new_task=2444 oom_score_adj=-1000
> bash-2444 [007] 205.868136: oom_score_task_rename: rename task 2444[su] to [bash] oom_ score_adj=-1000
> bash-2444 [007] 205.870407: oom_score_adj_inherited: new_task=2445 oom_score_adj=-1000
> bash-2445 [001] 205.870975: oom_score_adj_inherited: new_task=2446 oom_score_adj=-1000
>
Little bit of whitespace damage there, but looks good in the code itself.
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Just minor alterations to the format of the tracepoints from the first
version, so carry over my
Acked-by: David Rientjes <rientjes@google.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-07 0:54 [PATCH] oom: add tracepoints for oom_score_adj KAMEZAWA Hiroyuki
2011-12-07 1:22 ` David Rientjes
@ 2011-12-07 1:27 ` KAMEZAWA Hiroyuki
2011-12-07 1:55 ` [PATCH v3] " KAMEZAWA Hiroyuki
2011-12-07 16:52 ` [PATCH] " KOSAKI Motohiro
3 siblings, 0 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-07 1:27 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
Sorry, I found a mistake...
I'll post updated one, again.
Thanks,
-Kame
On Wed, 7 Dec 2011 09:54:34 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 7 Dec 2011 09:58:16 +0900
> Subject: [PATCH] oom: trace point for oom_score_adj
>
> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> Some daemons sets this value and their children inerit it sometimes.
> Because inheritance of oom_score_adj is done automatically, users
> can be confused at seeing the value and finds it's hard to debug.
>
> This patch adds trace point for oom_score_adj. This adds 3 trace
> points. at
> - update oom_score_adj
> - fork()
> - rename task->comm(typically, exec())
>
> Outputs will be following.
> bash-2404 [006] 199.620841: oom_score_adj_update: task 2404[bash] updates oom_score_ad j=-1000
> bash-2404 [006] 205.861287: oom_score_adj_inherited: new_task=2442 oom_score_adj=-1000
> su-2442 [003] 205.861761: oom_score_task_rename: rename task 2442[bash] to [su] oom_ score_adj=-1000
> su-2442 [003] 205.866737: oom_score_adj_inherited: new_task=2444 oom_score_adj=-1000
> bash-2444 [007] 205.868136: oom_score_task_rename: rename task 2444[su] to [bash] oom_ score_adj=-1000
> bash-2444 [007] 205.870407: oom_score_adj_inherited: new_task=2445 oom_score_adj=-1000
> bash-2445 [001] 205.870975: oom_score_adj_inherited: new_task=2446 oom_score_adj=-1000
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> fs/exec.c | 5 +++
> fs/proc/base.c | 3 ++
> include/trace/events/oom.h | 80 ++++++++++++++++++++++++++++++++++++++++++++
> kernel/fork.c | 5 +++
> mm/oom_kill.c | 6 +++
> 5 files changed, 99 insertions(+), 0 deletions(-)
> create mode 100644 include/trace/events/oom.h
>
> diff --git a/fs/exec.c b/fs/exec.c
> index ca141db..562a106 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -59,6 +59,8 @@
> #include <asm/uaccess.h>
> #include <asm/mmu_context.h>
> #include <asm/tlb.h>
> +
> +#include <trace/events/oom.h>
> #include "internal.h"
>
> int core_uses_pid;
> @@ -1054,6 +1056,9 @@ void set_task_comm(struct task_struct *tsk, char *buf)
> {
> task_lock(tsk);
>
> + if (tsk->signal->oom_score_adj)
> + trace_oom_score_task_rename(tsk, buf);
> +
> /*
> * Threads may access current->comm without holding
> * the task lock, so write the string carefully.
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 1050b1c..f201e64 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -87,6 +87,7 @@
> #ifdef CONFIG_HARDWALL
> #include <asm/hardwall.h>
> #endif
> +#include <trace/events/oom.h>
> #include "internal.h"
>
> /* NOTE:
> @@ -1166,6 +1167,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
> else
> task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) /
> -OOM_DISABLE;
> + trace_oom_score_adj_update(task);
> err_sighand:
> unlock_task_sighand(task, &flags);
> err_task_lock:
> @@ -1253,6 +1255,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
> task->signal->oom_score_adj = oom_score_adj;
> if (has_capability_noaudit(current, CAP_SYS_RESOURCE))
> task->signal->oom_score_adj_min = oom_score_adj;
> + trace_oom_score_adj_update(task);
> /*
> * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is
> * always attainable.
> diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
> new file mode 100644
> index 0000000..f5e6f55
> --- /dev/null
> +++ b/include/trace/events/oom.h
> @@ -0,0 +1,80 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM oom
> +
> +#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_OOM_H
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(oom_score_adj_inherited,
> +
> + TP_PROTO(struct task_struct *task),
> +
> + TP_ARGS(task),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, newpid)
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->newpid = task->pid;
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("new_task=%ld oom_score_adj=%d",
> + __entry->newpid, __entry->oom_score_adj)
> +);
> +
> +TRACE_EVENT(oom_score_task_rename,
> +
> + TP_PROTO(struct task_struct *task, char *comm),
> +
> + TP_ARGS(task, comm),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, pid)
> + __array( char, oldcomm, TASK_COMM_LEN )
> + __array( char, newcomm, TASK_COMM_LEN )
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->pid = task->pid;
> + memcpy(__entry->oldcomm, task->comm, TASK_COMM_LEN);
> + memcpy(__entry->newcomm, comm, TASK_COMM_LEN);
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("rename task %ld[%s] to [%s] oom_score_adj=%d",
> + __entry->pid, __entry->oldcomm, __entry->newcomm,
> + __entry->oom_score_adj)
> +);
> +
> +TRACE_EVENT(oom_score_adj_update,
> +
> + TP_PROTO(struct task_struct *task),
> +
> + TP_ARGS(task),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, pid)
> + __array( char, comm, TASK_COMM_LEN )
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->pid = task->pid;
> + memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("task %ld[%s] updates oom_score_adj=%d",
> + __entry->pid, __entry->comm, __entry->oom_score_adj)
> +);
> +
> +#endif
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> +
> +
> diff --git a/kernel/fork.c b/kernel/fork.c
> index e20518d..634aa84 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -76,6 +76,7 @@
> #include <asm/tlbflush.h>
>
> #include <trace/events/sched.h>
> +#include <trace/events/oom.h>
>
> /*
> * Protected counters by write_lock_irq(&tasklist_lock)
> @@ -1390,6 +1391,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> if (clone_flags & CLONE_THREAD)
> threadgroup_fork_read_unlock(current);
> perf_event_fork(p);
> +
> + if (!(clone_flags & CLONE_THREAD) && p->signal->oom_score_adj)
> + trace_oom_score_adj_inherited(p);
> +
> return p;
>
> bad_fork_free_pid:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index e2e1402..46b6d0a 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -33,6 +33,10 @@
> #include <linux/security.h>
> #include <linux/ptrace.h>
> #include <linux/freezer.h>
> +#include <linux/ftrace.h>
> +
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/oom.h>
>
> int sysctl_panic_on_oom;
> int sysctl_oom_kill_allocating_task;
> @@ -55,6 +59,7 @@ void compare_swap_oom_score_adj(int old_val, int new_val)
> spin_lock_irq(&sighand->siglock);
> if (current->signal->oom_score_adj == old_val)
> current->signal->oom_score_adj = new_val;
> + trace_oom_score_adj_update(current);
> spin_unlock_irq(&sighand->siglock);
> }
>
> @@ -74,6 +79,7 @@ int test_set_oom_score_adj(int new_val)
> spin_lock_irq(&sighand->siglock);
> old_val = current->signal->oom_score_adj;
> current->signal->oom_score_adj = new_val;
> + trace_oom_score_adj_update(current);
> spin_unlock_irq(&sighand->siglock);
>
> return old_val;
> --
> 1.7.4.1
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] oom: add tracepoints for oom_score_adj
2011-12-07 0:54 [PATCH] oom: add tracepoints for oom_score_adj KAMEZAWA Hiroyuki
2011-12-07 1:22 ` David Rientjes
2011-12-07 1:27 ` KAMEZAWA Hiroyuki
@ 2011-12-07 1:55 ` KAMEZAWA Hiroyuki
2011-12-07 16:52 ` [PATCH] " KOSAKI Motohiro
3 siblings, 0 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-07 1:55 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
Fixed compile warning and use TRACE_EVENT_CONDITION() rather than open-coded 'if'
==
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-07 0:54 [PATCH] oom: add tracepoints for oom_score_adj KAMEZAWA Hiroyuki
` (2 preceding siblings ...)
2011-12-07 1:55 ` [PATCH v3] " KAMEZAWA Hiroyuki
@ 2011-12-07 16:52 ` KOSAKI Motohiro
2011-12-08 1:47 ` KAMEZAWA Hiroyuki
3 siblings, 1 reply; 11+ messages in thread
From: KOSAKI Motohiro @ 2011-12-07 16:52 UTC (permalink / raw)
To: kamezawa.hiroyu; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
On 12/6/2011 7:54 PM, KAMEZAWA Hiroyuki wrote:
>>From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 7 Dec 2011 09:58:16 +0900
> Subject: [PATCH] oom: trace point for oom_score_adj
>
> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> Some daemons sets this value and their children inerit it sometimes.
> Because inheritance of oom_score_adj is done automatically, users
> can be confused at seeing the value and finds it's hard to debug.
>
> This patch adds trace point for oom_score_adj. This adds 3 trace
> points. at
> - update oom_score_adj
> - fork()
> - rename task->comm(typically, exec())
I don't think they have oom specific thing. Can you please add generic fork and
task rename tracepoint instead?
>
> Outputs will be following.
> bash-2404 [006] 199.620841: oom_score_adj_update: task 2404[bash] updates oom_score_ad j=-1000
"task 2404[bash]" don't look good to me.
In almost case, we use either
- [pid] comm
- pid:comm
- comm:pid
- comm-pid (ftrace specific)
Why do we need to introduce alternative printing style?
> bash-2404 [006] 205.861287: oom_score_adj_inherited: new_task=2442 oom_score_adj=-1000
> su-2442 [003] 205.861761: oom_score_task_rename: rename task 2442[bash] to [su] oom_ score_adj=-1000
> su-2442 [003] 205.866737: oom_score_adj_inherited: new_task=2444 oom_score_adj=-1000
> bash-2444 [007] 205.868136: oom_score_task_rename: rename task 2444[su] to [bash] oom_ score_adj=-1000
> bash-2444 [007] 205.870407: oom_score_adj_inherited: new_task=2445 oom_score_adj=-1000
> bash-2445 [001] 205.870975: oom_score_adj_inherited: new_task=2446 oom_score_adj=-1000
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> fs/exec.c | 5 +++
> fs/proc/base.c | 3 ++
> include/trace/events/oom.h | 80 ++++++++++++++++++++++++++++++++++++++++++++
> kernel/fork.c | 5 +++
> mm/oom_kill.c | 6 +++
> 5 files changed, 99 insertions(+), 0 deletions(-)
> create mode 100644 include/trace/events/oom.h
>
> diff --git a/fs/exec.c b/fs/exec.c
> index ca141db..562a106 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -59,6 +59,8 @@
> #include <asm/uaccess.h>
> #include <asm/mmu_context.h>
> #include <asm/tlb.h>
> +
> +#include <trace/events/oom.h>
> #include "internal.h"
>
> int core_uses_pid;
> @@ -1054,6 +1056,9 @@ void set_task_comm(struct task_struct *tsk, char *buf)
> {
> task_lock(tsk);
>
> + if (tsk->signal->oom_score_adj)
> + trace_oom_score_task_rename(tsk, buf);
> +
> /*
> * Threads may access current->comm without holding
> * the task lock, so write the string carefully.
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 1050b1c..f201e64 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -87,6 +87,7 @@
> #ifdef CONFIG_HARDWALL
> #include <asm/hardwall.h>
> #endif
> +#include <trace/events/oom.h>
> #include "internal.h"
>
> /* NOTE:
> @@ -1166,6 +1167,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
> else
> task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) /
> -OOM_DISABLE;
> + trace_oom_score_adj_update(task);
> err_sighand:
> unlock_task_sighand(task, &flags);
> err_task_lock:
> @@ -1253,6 +1255,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
> task->signal->oom_score_adj = oom_score_adj;
> if (has_capability_noaudit(current, CAP_SYS_RESOURCE))
> task->signal->oom_score_adj_min = oom_score_adj;
> + trace_oom_score_adj_update(task);
> /*
> * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is
> * always attainable.
> diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
> new file mode 100644
> index 0000000..f5e6f55
> --- /dev/null
> +++ b/include/trace/events/oom.h
> @@ -0,0 +1,80 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM oom
> +
> +#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_OOM_H
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(oom_score_adj_inherited,
> +
> + TP_PROTO(struct task_struct *task),
> +
> + TP_ARGS(task),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, newpid)
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->newpid = task->pid;
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("new_task=%ld oom_score_adj=%d",
> + __entry->newpid, __entry->oom_score_adj)
> +);
> +
> +TRACE_EVENT(oom_score_task_rename,
> +
> + TP_PROTO(struct task_struct *task, char *comm),
> +
> + TP_ARGS(task, comm),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, pid)
> + __array( char, oldcomm, TASK_COMM_LEN )
> + __array( char, newcomm, TASK_COMM_LEN )
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->pid = task->pid;
> + memcpy(__entry->oldcomm, task->comm, TASK_COMM_LEN);
> + memcpy(__entry->newcomm, comm, TASK_COMM_LEN);
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("rename task %ld[%s] to [%s] oom_score_adj=%d",
> + __entry->pid, __entry->oldcomm, __entry->newcomm,
> + __entry->oom_score_adj)
> +);
> +
> +TRACE_EVENT(oom_score_adj_update,
> +
> + TP_PROTO(struct task_struct *task),
> +
> + TP_ARGS(task),
> +
> + TP_STRUCT__entry(
> + __field( pid_t, pid)
> + __array( char, comm, TASK_COMM_LEN )
> + __field( int, oom_score_adj)
> + ),
> +
> + TP_fast_assign(
> + __entry->pid = task->pid;
> + memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
> + __entry->oom_score_adj = task->signal->oom_score_adj;
> + ),
> +
> + TP_printk("task %ld[%s] updates oom_score_adj=%d",
> + __entry->pid, __entry->comm, __entry->oom_score_adj)
> +);
> +
> +#endif
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> +
> +
> diff --git a/kernel/fork.c b/kernel/fork.c
> index e20518d..634aa84 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -76,6 +76,7 @@
> #include <asm/tlbflush.h>
>
> #include <trace/events/sched.h>
> +#include <trace/events/oom.h>
>
> /*
> * Protected counters by write_lock_irq(&tasklist_lock)
> @@ -1390,6 +1391,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> if (clone_flags & CLONE_THREAD)
> threadgroup_fork_read_unlock(current);
> perf_event_fork(p);
> +
> + if (!(clone_flags & CLONE_THREAD) && p->signal->oom_score_adj)
> + trace_oom_score_adj_inherited(p);
> +
> return p;
>
> bad_fork_free_pid:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index e2e1402..46b6d0a 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -33,6 +33,10 @@
> #include <linux/security.h>
> #include <linux/ptrace.h>
> #include <linux/freezer.h>
> +#include <linux/ftrace.h>
> +
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/oom.h>
>
> int sysctl_panic_on_oom;
> int sysctl_oom_kill_allocating_task;
> @@ -55,6 +59,7 @@ void compare_swap_oom_score_adj(int old_val, int new_val)
> spin_lock_irq(&sighand->siglock);
> if (current->signal->oom_score_adj == old_val)
> current->signal->oom_score_adj = new_val;
> + trace_oom_score_adj_update(current);
> spin_unlock_irq(&sighand->siglock);
> }
>
> @@ -74,6 +79,7 @@ int test_set_oom_score_adj(int new_val)
> spin_lock_irq(&sighand->siglock);
> old_val = current->signal->oom_score_adj;
> current->signal->oom_score_adj = new_val;
> + trace_oom_score_adj_update(current);
> spin_unlock_irq(&sighand->siglock);
>
> return old_val;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-07 16:52 ` [PATCH] " KOSAKI Motohiro
@ 2011-12-08 1:47 ` KAMEZAWA Hiroyuki
2011-12-08 6:32 ` [PATCH v4] " KAMEZAWA Hiroyuki
2011-12-08 17:33 ` [PATCH] " KOSAKI Motohiro
0 siblings, 2 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-08 1:47 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
On Wed, 07 Dec 2011 11:52:02 -0500
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> On 12/6/2011 7:54 PM, KAMEZAWA Hiroyuki wrote:
> >>From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > Date: Wed, 7 Dec 2011 09:58:16 +0900
> > Subject: [PATCH] oom: trace point for oom_score_adj
> >
> > oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> > Some daemons sets this value and their children inerit it sometimes.
> > Because inheritance of oom_score_adj is done automatically, users
> > can be confused at seeing the value and finds it's hard to debug.
> >
> > This patch adds trace point for oom_score_adj. This adds 3 trace
> > points. at
> > - update oom_score_adj
>
>
> > - fork()
> > - rename task->comm(typically, exec())
>
> I don't think they have oom specific thing. Can you please add generic fork and
> task rename tracepoint instead?
>
I think it makes oom-targeted debug difficult.
This tracehook using task->signal->oom_score_adj as filter.
This reduces traces much and makes debugging easier.
If you need another trace point for other purpose, another trace point
should be better. For generic purpose, oom_socre_adj filtering will not
be necessary.
> >
> > Outputs will be following.
> > bash-2404 [006] 199.620841: oom_score_adj_update: task 2404[bash] updates oom_score_ad j=-1000
>
> "task 2404[bash]" don't look good to me.
>
> In almost case, we use either
>
> - [pid] comm
> - pid:comm
> - comm:pid
> - comm-pid (ftrace specific)
>
> Why do we need to introduce alternative printing style?
>
No reason. ok, I'll fix.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4] oom: add tracepoints for oom_score_adj
2011-12-08 1:47 ` KAMEZAWA Hiroyuki
@ 2011-12-08 6:32 ` KAMEZAWA Hiroyuki
2014-02-04 8:39 ` Peter Zijlstra
2011-12-08 17:33 ` [PATCH] " KOSAKI Motohiro
1 sibling, 1 reply; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-08 6:32 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: KOSAKI Motohiro, linux-kernel, linux-mm, akpm, rientjes, dchinner
On Thu, 8 Dec 2011 10:47:05 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Wed, 07 Dec 2011 11:52:02 -0500
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
- [pid] comm
> > - pid:comm
> > - comm:pid
> > - comm-pid (ftrace specific)
> >
> > Why do we need to introduce alternative printing style?
> >
>
v4 here
==
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-08 1:47 ` KAMEZAWA Hiroyuki
2011-12-08 6:32 ` [PATCH v4] " KAMEZAWA Hiroyuki
@ 2011-12-08 17:33 ` KOSAKI Motohiro
2011-12-08 23:41 ` KAMEZAWA Hiroyuki
1 sibling, 1 reply; 11+ messages in thread
From: KOSAKI Motohiro @ 2011-12-08 17:33 UTC (permalink / raw)
To: kamezawa.hiroyu; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
On 12/7/2011 8:47 PM, KAMEZAWA Hiroyuki wrote:
> On Wed, 07 Dec 2011 11:52:02 -0500
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
>> On 12/6/2011 7:54 PM, KAMEZAWA Hiroyuki wrote:
>>> >From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
>>> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>> Date: Wed, 7 Dec 2011 09:58:16 +0900
>>> Subject: [PATCH] oom: trace point for oom_score_adj
>>>
>>> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
>>> Some daemons sets this value and their children inerit it sometimes.
>>> Because inheritance of oom_score_adj is done automatically, users
>>> can be confused at seeing the value and finds it's hard to debug.
>>>
>>> This patch adds trace point for oom_score_adj. This adds 3 trace
>>> points. at
>>> - update oom_score_adj
>>
>>
>>> - fork()
>>> - rename task->comm(typically, exec())
>>
>> I don't think they have oom specific thing. Can you please add generic fork and
>> task rename tracepoint instead?
>>
> I think it makes oom-targeted debug difficult.
> This tracehook using task->signal->oom_score_adj as filter.
> This reduces traces much and makes debugging easier.
>
> If you need another trace point for other purpose, another trace point
> should be better. For generic purpose, oom_socre_adj filtering will not
> be necessary.
see Documentation/trace/event.txt 5. Event filgtering
Now, both ftrace and perf have good filter feature. Isn't this enough?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-08 17:33 ` [PATCH] " KOSAKI Motohiro
@ 2011-12-08 23:41 ` KAMEZAWA Hiroyuki
2011-12-09 0:33 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-08 23:41 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: linux-kernel, linux-mm, akpm, rientjes, dchinner
On Thu, 08 Dec 2011 12:33:35 -0500
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> On 12/7/2011 8:47 PM, KAMEZAWA Hiroyuki wrote:
> > On Wed, 07 Dec 2011 11:52:02 -0500
> > KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> >
> >> On 12/6/2011 7:54 PM, KAMEZAWA Hiroyuki wrote:
> >>> >From 28189e4622fd97324893a0b234183f64472a54d6 Mon Sep 17 00:00:00 2001
> >>> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >>> Date: Wed, 7 Dec 2011 09:58:16 +0900
> >>> Subject: [PATCH] oom: trace point for oom_score_adj
> >>>
> >>> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> >>> Some daemons sets this value and their children inerit it sometimes.
> >>> Because inheritance of oom_score_adj is done automatically, users
> >>> can be confused at seeing the value and finds it's hard to debug.
> >>>
> >>> This patch adds trace point for oom_score_adj. This adds 3 trace
> >>> points. at
> >>> - update oom_score_adj
> >>
> >>
> >>> - fork()
> >>> - rename task->comm(typically, exec())
> >>
> >> I don't think they have oom specific thing. Can you please add generic fork and
> >> task rename tracepoint instead?
> >>
> > I think it makes oom-targeted debug difficult.
> > This tracehook using task->signal->oom_score_adj as filter.
> > This reduces traces much and makes debugging easier.
> >
> > If you need another trace point for other purpose, another trace point
> > should be better. For generic purpose, oom_socre_adj filtering will not
> > be necessary.
>
> see Documentation/trace/event.txt 5. Event filgtering
>
> Now, both ftrace and perf have good filter feature. Isn't this enough?
>
Could you make patch ? Then, I stop this and go other probelm.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] oom: add tracepoints for oom_score_adj
2011-12-08 23:41 ` KAMEZAWA Hiroyuki
@ 2011-12-09 0:33 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 11+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-09 0:33 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: KOSAKI Motohiro, linux-kernel, linux-mm, akpm, rientjes, dchinner
On Fri, 9 Dec 2011 08:41:03 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 08 Dec 2011 12:33:35 -0500
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
see Documentation/trace/event.txt 5. Event filgtering
> >
> > Now, both ftrace and perf have good filter feature. Isn't this enough?
> >
>
> Could you make patch ? Then, I stop this and go other probelm.
>
Hmm, core of patch should be like this. But need some works on
- How to debug oom in Documenation especially for trace-cmd users.
- Other trace points sutable for 'task' tracing. maybe 'exit, stop, freeze' ?
- at creating new task, what other members should be printed out ?
- At renaming...don't we need reason for renaming ?
Hm. BTW, do you know how to write filtering in
/etc/sysconfig/trace-cmd.config ?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4] oom: add tracepoints for oom_score_adj
2011-12-08 6:32 ` [PATCH v4] " KAMEZAWA Hiroyuki
@ 2014-02-04 8:39 ` Peter Zijlstra
0 siblings, 0 replies; 11+ messages in thread
From: Peter Zijlstra @ 2014-02-04 8:39 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: KOSAKI Motohiro, linux-kernel, linux-mm, akpm, rientjes, dchinner
On Thu, Dec 08, 2011 at 03:32:30PM +0900, KAMEZAWA Hiroyuki wrote:
> From 5dc1f8c879ae424d5853af255df8860494209e39 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 7 Dec 2011 09:58:16 +0900
> Subject: [PATCH] oom: trace point for oom_score_adj
>
> oom_score_adj is set to prevent a task from being killed by OOM-Killer.
> Some daemons sets this value and their children inerit it sometimes.
> Because inheritance of oom_score_adj is done automatically, users
> can be confused at seeing the value and finds it's hard to debug.
>
> This patch adds trace point for oom_score_adj. This adds 3 trace
> points. at
> - update oom_score_adj
> - fork()
> - rename task->comm(typically, exec())
>
And nobody was bothered by the fact that we already had fork and exec tracepoints?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-02-04 8:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 0:54 [PATCH] oom: add tracepoints for oom_score_adj KAMEZAWA Hiroyuki
2011-12-07 1:22 ` David Rientjes
2011-12-07 1:27 ` KAMEZAWA Hiroyuki
2011-12-07 1:55 ` [PATCH v3] " KAMEZAWA Hiroyuki
2011-12-07 16:52 ` [PATCH] " KOSAKI Motohiro
2011-12-08 1:47 ` KAMEZAWA Hiroyuki
2011-12-08 6:32 ` [PATCH v4] " KAMEZAWA Hiroyuki
2014-02-04 8:39 ` Peter Zijlstra
2011-12-08 17:33 ` [PATCH] " KOSAKI Motohiro
2011-12-08 23:41 ` KAMEZAWA Hiroyuki
2011-12-09 0:33 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox