lkml.org 
[lkml]   [2014]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 3/4] OOM, PM: OOM killed task shouldn't escape PM suspend
Date
On Tuesday, October 21, 2014 03:14:45 PM Michal Hocko wrote:
> On Tue 21-10-14 14:09:27, Rafael J. Wysocki wrote:
> [...]
> > > @@ -131,12 +132,40 @@ int freeze_processes(void)
> > >
> > > printk("Freezing user space processes ... ");
> > > pm_freezing = true;
> > > + oom_kills_saved = oom_kills_count();
> > > error = try_to_freeze_tasks(true);
> > > if (!error) {
> > > - printk("done.");
> > > __usermodehelper_set_disable_depth(UMH_DISABLED);
> > > oom_killer_disable();
> > > +
> > > + /*
> > > + * There might have been an OOM kill while we were
> > > + * freezing tasks and the killed task might be still
> > > + * on the way out so we have to double check for race.
> > > + */
> > > + if (oom_kills_count() != oom_kills_saved) {
> > > + struct task_struct *g, *p;
> > > +
> > > + read_lock(&tasklist_lock);
> > > + for_each_process_thread(g, p) {
> > > + if (p == current || freezer_should_skip(p) ||
> > > + frozen(p))
> > > + continue;
> > > + error = -EBUSY;
> > > + goto out_loop;
> > > + }
> > > +out_loop:
> >
> > Well, it looks like this will work here too:
> >
> > for_each_process_thread(g, p)
> > if (p != current && !frozen(p) &&
> > !freezer_should_skip(p)) {
> > error = -EBUSY;
> > break;
> > }
> >
> > or I am helplessly misreading the code.
>
> break will not work because for_each_process_thread is a double loop.

I see. In that case I'd do:

for_each_process_thread(g, p)
if (p != current && !frozen(p) &&
!freezer_should_skip(p)) {

read_unlock(&tasklist_lock);

__usermodehelper_set_disable_depth(UMH_ENABLED);
printk("OOM in progress.");
error = -EBUSY;
goto done;
}

to avoid adding the new label that looks odd.

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.


\
 
 \ /
  Last update: 2014-10-21 16:01    [W:0.526 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site