[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160530070705.GD22928@dhcp22.suse.cz>
Date: Mon, 30 May 2016 09:07:05 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Vladimir Davydov <vdavydov@...tuozzo.com>
Cc: linux-mm@...ck.org,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
David Rientjes <rientjes@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have
same view of oom_score_adj
On Fri 27-05-16 19:18:21, Vladimir Davydov wrote:
> On Fri, May 27, 2016 at 01:18:03PM +0200, Michal Hocko wrote:
> ...
> > @@ -1087,7 +1105,25 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
> > unlock_task_sighand(task, &flags);
> > err_put_task:
> > put_task_struct(task);
> > +
> > + if (mm) {
> > + struct task_struct *p;
> > +
> > + rcu_read_lock();
> > + for_each_process(p) {
> > + task_lock(p);
> > + if (!p->vfork_done && process_shares_mm(p, mm)) {
> > + p->signal->oom_score_adj = oom_adj;
> > + if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE))
> > + p->signal->oom_score_adj_min = (short)oom_adj;
> > + }
> > + task_unlock(p);
>
> I.e. you write to /proc/pid1/oom_score_adj and get
> /proc/pid2/oom_score_adj updated if pid1 and pid2 share mm?
> IMO that looks unexpected from userspace pov.
How much different it is from threads in the same thread group?
Processes sharing the mm without signals is a rather weird threading
model isn't it? Currently we just lie to users about their oom_score_adj
in this weird corner case. The only exception was OOM_SCORE_ADJ_MIN
where we really didn't kill the task but all other values are simply
ignored in practice.
> May be, we'd better add mm->oom_score_adj and set it to the min
> signal->oom_score_adj over all processes sharing it? This would
> require iterating over all processes every time oom_score_adj gets
> updated, but that's a slow path.
Not sure I understand. So you would prefer that mm->oom_score_adj might
disagree with p->signal->oom_score_adj?
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists