Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280378
b: refs/heads/master
c: 96ee6d8
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Nov 21, 2011
1 parent f643673 commit 14e6381
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 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: 948246f70a811c872b9d93bb4a8ab5823c4c79e0
refs/heads/master: 96ee6d8539c9fc6742908d85eb9723abb5c91854
9 changes: 5 additions & 4 deletions trunk/include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static inline bool try_to_freeze(void)
}

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

#ifdef CONFIG_CGROUP_FREEZER
extern bool cgroup_freezing(struct task_struct *task);
Expand Down Expand Up @@ -106,18 +107,18 @@ static inline int freezer_should_skip(struct task_struct *p)
/*
* Tell the freezer that the current task should be frozen by it
*/
static inline void set_freezable(void)
static inline bool set_freezable(void)
{
current->flags &= ~PF_NOFREEZE;
return __set_freezable(false);
}

/*
* Tell the freezer that the current task should be frozen by it and that it
* should send a fake signal to the task to freeze it.
*/
static inline void set_freezable_with_signal(void)
static inline bool set_freezable_with_signal(void)
{
current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG);
return __set_freezable(true);
}

/*
Expand Down
25 changes: 25 additions & 0 deletions trunk/kernel/freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,28 @@ void __thaw_task(struct task_struct *p)
}
spin_unlock_irqrestore(&freezer_lock, flags);
}

/**
* __set_freezable - make %current freezable
* @with_signal: do we want %TIF_SIGPENDING for notification too?
*
* Mark %current freezable and enter refrigerator if necessary.
*/
bool __set_freezable(bool with_signal)
{
might_sleep();

/*
* Modify flags while holding freezer_lock. This ensures the
* freezer notices that we aren't frozen yet or the freezing
* condition is visible to try_to_freeze() below.
*/
spin_lock_irq(&freezer_lock);
current->flags &= ~PF_NOFREEZE;
if (with_signal)
current->flags &= ~PF_FREEZER_NOSIG;
spin_unlock_irq(&freezer_lock);

return try_to_freeze();
}
EXPORT_SYMBOL(__set_freezable);

0 comments on commit 14e6381

Please sign in to comment.