Skip to content

Commit

Permalink
freezer: remove unused @sig_only from freeze_task()
Browse files Browse the repository at this point in the history
After "freezer: make freezing() test freeze conditions in effect
instead of TIF_FREEZE", freezing() returns authoritative answer on
whether the current task should freeze or not and freeze_task()
doesn't need or use @sig_only.  Remove it.

While at it, rewrite function comment for freeze_task() and rename
@sig_only to @user_only in try_to_freeze_tasks().

This patch doesn't cause any functional change.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: Oleg Nesterov <[email protected]>
  • Loading branch information
htejun committed Nov 21, 2011
1 parent 37ad8ac commit 839e340
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static inline bool try_to_freeze(void)
return __refrigerator(false);
}

extern bool freeze_task(struct task_struct *p, bool sig_only);
extern bool freeze_task(struct task_struct *p);
extern bool __set_freezable(bool with_signal);

#ifdef CONFIG_CGROUP_FREEZER
Expand Down
4 changes: 2 additions & 2 deletions kernel/cgroup_freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void freezer_fork(struct cgroup_subsys *ss, struct task_struct *task)

/* Locking avoids race with FREEZING -> THAWED transitions. */
if (freezer->state == CGROUP_FREEZING)
freeze_task(task, true);
freeze_task(task);
spin_unlock_irq(&freezer->lock);
}

Expand Down Expand Up @@ -274,7 +274,7 @@ static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)

cgroup_iter_start(cgroup, &it);
while ((task = cgroup_iter_next(cgroup, &it))) {
if (!freeze_task(task, true))
if (!freeze_task(task))
continue;
if (frozen(task))
continue;
Expand Down
21 changes: 9 additions & 12 deletions kernel/freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,17 @@ static void fake_signal_wake_up(struct task_struct *p)
}

/**
* freeze_task - send a freeze request to given task
* @p: task to send the request to
* @sig_only: if set, the request will only be sent if the task has the
* PF_FREEZER_NOSIG flag unset
* Return value: 'false', if @sig_only is set and the task has
* PF_FREEZER_NOSIG set or the task is frozen, 'true', otherwise
* freeze_task - send a freeze request to given task
* @p: task to send the request to
*
* The freeze request is sent by setting the tasks's TIF_FREEZE flag and
* either sending a fake signal to it or waking it up, depending on whether
* or not it has PF_FREEZER_NOSIG set. If @sig_only is set and the task
* has PF_FREEZER_NOSIG set (ie. it is a typical kernel thread), its
* TIF_FREEZE flag will not be set.
* If @p is freezing, the freeze request is sent by setting %TIF_FREEZE
* flag and either sending a fake signal to it or waking it up, depending
* on whether it has %PF_FREEZER_NOSIG set.
*
* RETURNS:
* %false, if @p is not freezing or already frozen; %true, otherwise
*/
bool freeze_task(struct task_struct *p, bool sig_only)
bool freeze_task(struct task_struct *p)
{
unsigned long flags;

Expand Down
8 changes: 4 additions & 4 deletions kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
#define TIMEOUT (20 * HZ)

static int try_to_freeze_tasks(bool sig_only)
static int try_to_freeze_tasks(bool user_only)
{
struct task_struct *g, *p;
unsigned long end_time;
Expand All @@ -37,14 +37,14 @@ static int try_to_freeze_tasks(bool sig_only)

end_time = jiffies + TIMEOUT;

if (!sig_only)
if (!user_only)
freeze_workqueues_begin();

while (true) {
todo = 0;
read_lock(&tasklist_lock);
do_each_thread(g, p) {
if (p == current || !freeze_task(p, sig_only))
if (p == current || !freeze_task(p))
continue;

/*
Expand All @@ -65,7 +65,7 @@ static int try_to_freeze_tasks(bool sig_only)
} while_each_thread(g, p);
read_unlock(&tasklist_lock);

if (!sig_only) {
if (!user_only) {
wq_busy = freeze_workqueues_busy();
todo += wq_busy;
}
Expand Down

0 comments on commit 839e340

Please sign in to comment.