Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280366
b: refs/heads/master
c: a5be2d0
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Nov 21, 2011
1 parent 5281ff8 commit 0712288
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a32c441c1609f80e55df75422324a1151208f40
refs/heads/master: a5be2d0d1a8746e7be5210e3d6b904455000443c
3 changes: 1 addition & 2 deletions trunk/include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static inline bool should_send_signal(struct task_struct *p)
}

/* Takes and releases task alloc lock using task_lock() */
extern int thaw_process(struct task_struct *p);
extern void __thaw_task(struct task_struct *t);

extern bool __refrigerator(bool check_kthr_stop);
extern int freeze_processes(void);
Expand Down Expand Up @@ -178,7 +178,6 @@ static inline int frozen(struct task_struct *p) { return 0; }
static inline int freezing(struct task_struct *p) { return 0; }
static inline void set_freeze_flag(struct task_struct *p) {}
static inline void clear_freeze_flag(struct task_struct *p) {}
static inline int thaw_process(struct task_struct *p) { return 1; }

static inline bool __refrigerator(bool check_kthr_stop) { return false; }
static inline int freeze_processes(void) { return -ENOSYS; }
Expand Down
7 changes: 3 additions & 4 deletions trunk/kernel/cgroup_freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct cgroup_subsys freezer_subsys;
* write_lock css_set_lock (cgroup iterator start)
* task->alloc_lock
* read_lock css_set_lock (cgroup iterator start)
* task->alloc_lock (inside thaw_process(), prevents race with refrigerator())
* task->alloc_lock (inside __thaw_task(), prevents race with refrigerator())
* sighand->siglock
*/
static struct cgroup_subsys_state *freezer_create(struct cgroup_subsys *ss,
Expand Down Expand Up @@ -300,9 +300,8 @@ static void unfreeze_cgroup(struct cgroup *cgroup, struct freezer *freezer)
struct task_struct *task;

cgroup_iter_start(cgroup, &it);
while ((task = cgroup_iter_next(cgroup, &it))) {
thaw_process(task);
}
while ((task = cgroup_iter_next(cgroup, &it)))
__thaw_task(task);
cgroup_iter_end(cgroup, &it);

freezer->state = CGROUP_THAWED;
Expand Down
31 changes: 12 additions & 19 deletions trunk/kernel/freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,34 +145,27 @@ void cancel_freezing(struct task_struct *p)
}
}

static int __thaw_process(struct task_struct *p)
{
if (frozen(p)) {
p->flags &= ~PF_FROZEN;
return 1;
}
clear_freeze_flag(p);
return 0;
}

/*
* Wake up a frozen process
* Wake up a frozen task
*
* task_lock() is needed to prevent the race with refrigerator() which may
* occur if the freezing of tasks fails. Namely, without the lock, if the
* freezing of tasks failed, thaw_tasks() might have run before a task in
* refrigerator() could call frozen_process(), in which case the task would be
* frozen and no one would thaw it.
*/
int thaw_process(struct task_struct *p)
void __thaw_task(struct task_struct *p)
{
bool was_frozen;

task_lock(p);
if (__thaw_process(p) == 1) {
task_unlock(p);
wake_up_process(p);
return 1;
}
was_frozen = frozen(p);
if (was_frozen)
p->flags &= ~PF_FROZEN;
else
clear_freeze_flag(p);
task_unlock(p);
return 0;

if (was_frozen)
wake_up_process(p);
}
EXPORT_SYMBOL(thaw_process);
2 changes: 1 addition & 1 deletion trunk/kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static void thaw_tasks(bool nosig_only)
if (cgroup_freezing_or_frozen(p))
continue;

thaw_process(p);
__thaw_task(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
*/
if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
if (unlikely(frozen(p)))
thaw_process(p);
__thaw_task(p);
return ERR_PTR(-1UL);
}
if (!p->mm)
Expand Down

0 comments on commit 0712288

Please sign in to comment.