Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1408181

Re: [PATCH 4/6] mm, oom: skip over vforked tasks

From Vladimir Davydov <vdavydov@virtuozzo.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/6] mm, oom: skip over vforked tasks
Date 2016-05-27 18:50 +0200
Message-ID <rDt7s-5Rp-7@gated-at.bofh.it> (permalink)
References <rD2TD-6uy-5@gated-at.bofh.it> <rD2TE-6uy-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 26, 2016 at 02:40:13PM +0200, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> vforked tasks are not really sitting on memory so it doesn't matter much
> to kill them. Parents are waiting for vforked task killable so it is
> better to chose parent which is the real mm owner. Teach oom_badness
> to ignore all tasks which haven't passed mm_release. oom_kill_process
> should ignore them as well because they will drop the mm soon and they
> will not block oom_reaper because they cannot touch any memory.

That is, if a process calls vfork->exec to spawn a child, and a newly
spawned child happens to invoke oom somewhere in exec, instead of
killing the child, which hasn't done anything yet, we'll kill the main
process while the child continues to run. Not sure if it's really bad
though.

...
> @@ -839,6 +841,13 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
>  	for_each_process(p) {
>  		if (!process_shares_mm(p, mm))
>  			continue;
> +		/*
> +		 * vforked tasks are ignored because they will drop the mm soon
> +		 * hopefully and even if not they will not mind being oom
> +		 * reaped because they cannot touch any memory.

They shouldn't modify memory, but they still can touch it AFAIK.

> +		 */
> +		if (p->vfork_done)
> +			continue;
>  		if (same_thread_group(p, victim))
>  			continue;
>  		if (unlikely(p->flags & PF_KTHREAD) || is_global_init(p) ||

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko <mhocko@kernel.org> - 2016-05-26 14:50 +0200
  Re: [PATCH 4/6] mm, oom: skip over vforked tasks Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-27 18:50 +0200
    Re: [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko <mhocko@kernel.org> - 2016-05-30 09:20 +0200
      Re: [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko <mhocko@kernel.org> - 2016-05-30 12:00 +0200
        Re: [PATCH 4/6] mm, oom: skip over vforked tasks Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-30 12:50 +0200
          Re: [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko <mhocko@kernel.org> - 2016-05-30 13:00 +0200
  Re: [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko <mhocko@kernel.org> - 2016-05-30 14:10 +0200

csiph-web