linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Ming Liu <ming.liu@windriver.com>
Cc: akpm@linux-foundation.org, mhocko@suse.cz, rusty@rustcorp.com.au,
	hannes@cmpxchg.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V1] oom: avoid selecting threads sharing mm with init
Date: Thu, 26 Sep 2013 11:44:13 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1309261143160.10904@chino.kir.corp.google.com> (raw)
In-Reply-To: <1380182957-3231-1-git-send-email-ming.liu@windriver.com>

On Thu, 26 Sep 2013, Ming Liu wrote:

> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 314e9d2..7e50a95 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -113,11 +113,22 @@ struct task_struct *find_lock_task_mm(struct task_struct *p)
>  static bool oom_unkillable_task(struct task_struct *p,
>  		const struct mem_cgroup *memcg, const nodemask_t *nodemask)
>  {
> +	struct task_struct *init_tsk;
> +
>  	if (is_global_init(p))
>  		return true;
>  	if (p->flags & PF_KTHREAD)
>  		return true;
>  
> +	/* It won't help free memory if p is sharing mm with init */
> +	rcu_read_lock();
> +	init_tsk = find_task_by_pid_ns(1, &init_pid_ns);
> +	if(p->mm == init_tsk->mm) {
> +		rcu_read_unlock();
> +		return true;
> +	}
> +	rcu_read_unlock();
> +
>  	/* When mem_cgroup_out_of_memory() and p is not member of the group */
>  	if (memcg && !task_in_mem_cgroup(p, memcg))
>  		return true;

You're aware of init_mm?

Can you post the kernel log when one of these "extreme cases" happens?

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

  reply	other threads:[~2013-09-26 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26  8:09 Ming Liu
2013-09-26 18:44 ` David Rientjes [this message]
2013-09-27  2:04   ` Ming Liu
2013-10-02  3:52     ` David Rientjes

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=alpine.DEB.2.02.1309261143160.10904@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=ming.liu@windriver.com \
    --cc=rusty@rustcorp.com.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox