All of lore.kernel.org
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
	"Luis Claudio R. Goncalves" <lclaudio@uudg.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Nick Piggin <npiggin@suse.de>,
	Minchan Kim <minchan.kim@gmail.com>
Subject: Re: [PATCH 08/10] oom: use send_sig() instead force_sig()
Date: Sun, 13 Jun 2010 20:24:52 +0900 (JST)	[thread overview]
Message-ID: <20100613180912.617B.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20100608184144.GA5914@redhat.com>

> On 06/08, KOSAKI Motohiro wrote:
> >
> > Oleg pointed out oom_kill.c has force_sig() abuse. force_sig() mean
> > ignore signal mask. but SIGKILL itself is not maskable.
> 
> Yes. And we have other reasons to avoid force_sig(). It should be used
> only for synchronous signals.
> 
> But,
> 
> > @@ -399,7 +399,7 @@ static int __oom_kill_process(struct task_struct *p, struct mem_cgroup *mem)
> >  	p->rt.time_slice = HZ;
> >  	set_tsk_thread_flag(p, TIF_MEMDIE);
> >
> > -	force_sig(SIGKILL, p);
> > +	send_sig(SIGKILL, p, 1);
> 
> This is not right, we need send_sig(SIGKILL, p, 0). Better yet,
> send_sig_info(SIGKILL, SEND_SIG_NOINFO). I think send_sig() should
> die.
> 
> The reason is that si_fromuser() must be true, otherwise we can't kill
> the SIGNAL_UNKILLABLE (sub-namespace inits) tasks.

Thanks. I am not signal expert. 
To be honest, current special siginfo arguments have a bit unclear meanings
to me ;)
current definition (following) doesn't teach anything.

sched.h
=====================
/* These can be the second arg to send_sig_info/send_group_sig_info.  */
#define SEND_SIG_NOINFO ((struct siginfo *) 0)
#define SEND_SIG_PRIV   ((struct siginfo *) 1)
#define SEND_SIG_FORCED ((struct siginfo *) 2)


If anyone write exact meanings, I'm really really glad.



> Oh. This reminds me, we really need the trivial (but annoying) cleanups
> here. The usage of SEND_SIG_ constants is messy, and they should be
> renamed at least.
> 
> And in fact, we need the new one which acts like SEND_SIG_FORCED but
> si_fromuser(). We do not want to allocate the memory when the caller
> is oom_kill or zap_pid_ns_processes().
> 
> OK. I'll send the simple patch which adds the new helper with the
> comment. send_sigkill() or kernel_kill_task(), or do you see a
> better name?

Very thanks. both name are pretty good to me.




WARNING: multiple messages have this Message-ID (diff)
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
	"Luis Claudio R. Goncalves" <lclaudio@uudg.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Nick Piggin <npiggin@suse.de>,
	Minchan Kim <minchan.kim@gmail.com>
Subject: Re: [PATCH 08/10] oom: use send_sig() instead force_sig()
Date: Sun, 13 Jun 2010 20:24:52 +0900 (JST)	[thread overview]
Message-ID: <20100613180912.617B.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20100608184144.GA5914@redhat.com>

> On 06/08, KOSAKI Motohiro wrote:
> >
> > Oleg pointed out oom_kill.c has force_sig() abuse. force_sig() mean
> > ignore signal mask. but SIGKILL itself is not maskable.
> 
> Yes. And we have other reasons to avoid force_sig(). It should be used
> only for synchronous signals.
> 
> But,
> 
> > @@ -399,7 +399,7 @@ static int __oom_kill_process(struct task_struct *p, struct mem_cgroup *mem)
> >  	p->rt.time_slice = HZ;
> >  	set_tsk_thread_flag(p, TIF_MEMDIE);
> >
> > -	force_sig(SIGKILL, p);
> > +	send_sig(SIGKILL, p, 1);
> 
> This is not right, we need send_sig(SIGKILL, p, 0). Better yet,
> send_sig_info(SIGKILL, SEND_SIG_NOINFO). I think send_sig() should
> die.
> 
> The reason is that si_fromuser() must be true, otherwise we can't kill
> the SIGNAL_UNKILLABLE (sub-namespace inits) tasks.

Thanks. I am not signal expert. 
To be honest, current special siginfo arguments have a bit unclear meanings
to me ;)
current definition (following) doesn't teach anything.

sched.h
=====================
/* These can be the second arg to send_sig_info/send_group_sig_info.  */
#define SEND_SIG_NOINFO ((struct siginfo *) 0)
#define SEND_SIG_PRIV   ((struct siginfo *) 1)
#define SEND_SIG_FORCED ((struct siginfo *) 2)


If anyone write exact meanings, I'm really really glad.



> Oh. This reminds me, we really need the trivial (but annoying) cleanups
> here. The usage of SEND_SIG_ constants is messy, and they should be
> renamed at least.
> 
> And in fact, we need the new one which acts like SEND_SIG_FORCED but
> si_fromuser(). We do not want to allocate the memory when the caller
> is oom_kill or zap_pid_ns_processes().
> 
> OK. I'll send the simple patch which adds the new helper with the
> comment. send_sigkill() or kernel_kill_task(), or do you see a
> better name?

Very thanks. both name are pretty good to me.



--
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>

  parent reply	other threads:[~2010-06-13 11:25 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 11:53 [0/10] 3rd pile of OOM patch series KOSAKI Motohiro
2010-06-08 11:53 ` KOSAKI Motohiro
2010-06-08 11:54 ` [PATCH 01/10] oom: don't try to kill oom_unkillable child KOSAKI Motohiro
2010-06-08 11:54   ` KOSAKI Motohiro
2010-06-08 19:10   ` David Rientjes
2010-06-08 19:10     ` David Rientjes
2010-06-08 11:55 ` [PATCH 02/10] oom: remove verbose argument from __oom_kill_process() KOSAKI Motohiro
2010-06-08 11:55   ` KOSAKI Motohiro
2010-06-08 19:09   ` David Rientjes
2010-06-08 19:09     ` David Rientjes
2010-06-08 11:56 ` [PATCH 03/10] oom: rename badness() to oom_badness() KOSAKI Motohiro
2010-06-08 11:56   ` KOSAKI Motohiro
2010-06-08 19:09   ` David Rientjes
2010-06-08 19:09     ` David Rientjes
2010-06-08 11:57 ` [PATCH 04/10] oom: move sysctl declarations to oom.h KOSAKI Motohiro
2010-06-08 11:57   ` KOSAKI Motohiro
2010-06-08 11:58 ` [PATCH 05/10] oom: enable oom tasklist dump by default KOSAKI Motohiro
2010-06-08 11:58   ` KOSAKI Motohiro
2010-06-08 11:59 ` [PATCH 06/10] oom: cleanup has_intersects_mems_allowed() KOSAKI Motohiro
2010-06-08 11:59   ` KOSAKI Motohiro
2010-06-08 19:07   ` David Rientjes
2010-06-08 19:07     ` David Rientjes
2010-06-08 11:59 ` [PATCH 07/10] oom: kill useless debug print KOSAKI Motohiro
2010-06-08 11:59   ` KOSAKI Motohiro
2010-06-08 19:01   ` David Rientjes
2010-06-08 19:01     ` David Rientjes
2010-06-08 12:01 ` [PATCH 08/10] oom: use send_sig() instead force_sig() KOSAKI Motohiro
2010-06-08 12:01   ` KOSAKI Motohiro
2010-06-08 18:41   ` Oleg Nesterov
2010-06-08 18:41     ` Oleg Nesterov
2010-06-10  0:59     ` [PATCH 0/1] signals: introduce send_sigkill() helper Oleg Nesterov
2010-06-10  0:59       ` Oleg Nesterov
2010-06-10  1:00       ` [PATCH 1/1] " Oleg Nesterov
2010-06-10  1:00         ` Oleg Nesterov
2010-06-11  0:40         ` KAMEZAWA Hiroyuki
2010-06-11  0:40           ` KAMEZAWA Hiroyuki
2010-06-13 11:24         ` KOSAKI Motohiro
2010-06-13 11:24           ` KOSAKI Motohiro
2010-06-13 15:29         ` Oleg Nesterov
2010-06-13 15:29           ` Oleg Nesterov
2010-06-16 10:00           ` KOSAKI Motohiro
2010-06-16 10:00             ` KOSAKI Motohiro
2010-06-13 11:24     ` KOSAKI Motohiro [this message]
2010-06-13 11:24       ` [PATCH 08/10] oom: use send_sig() instead force_sig() KOSAKI Motohiro
2010-06-08 12:02 ` [PATCH 09/10] oom: filter tasks not sharing the same cpuset KOSAKI Motohiro
2010-06-08 12:02   ` KOSAKI Motohiro
2010-06-08 19:05   ` David Rientjes
2010-06-08 19:05     ` David Rientjes
2010-06-08 12:04 ` [PATCH 10/10] oom: select task from tasklist for mempolicy ooms KOSAKI Motohiro
2010-06-08 12:04   ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100613180912.617B.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lclaudio@uudg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=npiggin@suse.de \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.