Skip to content

Commit

Permalink
PM / freezer: Clean up code after recent fixes
Browse files Browse the repository at this point in the history
Clean up the code in process.c after recent changes to get rid of
unnecessary labels and goto statements.

Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
rafaeljw committed Oct 22, 2014
1 parent a28e785 commit 71be211
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,27 @@ static int try_to_freeze_tasks(bool user_only)
return todo ? -EBUSY : 0;
}

static bool __check_frozen_processes(void)
{
struct task_struct *g, *p;

for_each_process_thread(g, p)
if (p != current && !freezer_should_skip(p) && !frozen(p))
return false;

return true;
}

/*
* Returns true if all freezable tasks (except for current) are frozen already
*/
static bool check_frozen_processes(void)
{
struct task_struct *g, *p;
bool ret = true;
bool ret;

read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
if (p != current && !freezer_should_skip(p) &&
!frozen(p)) {
ret = false;
goto done;
}
}
done:
ret = __check_frozen_processes();
read_unlock(&tasklist_lock);

return ret;
}

Expand Down Expand Up @@ -167,15 +169,14 @@ int freeze_processes(void)
* on the way out so we have to double check for race.
*/
if (oom_kills_count() != oom_kills_saved &&
!check_frozen_processes()) {
!check_frozen_processes()) {
__usermodehelper_set_disable_depth(UMH_ENABLED);
printk("OOM in progress.");
error = -EBUSY;
goto done;
} else {
printk("done.");
}
printk("done.");
}
done:
printk("\n");
BUG_ON(in_atomic());

Expand Down

0 comments on commit 71be211

Please sign in to comment.