diff options
author | Colin Cross <ccross@android.com> | 2013-05-06 23:50:12 +0000 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-08-30 19:10:56 -0700 |
commit | c8ec499070a753f8a34f1331a67c8b755a6f40b9 (patch) | |
tree | db7b9e300e8af0e4abbd578570e8634587d48009 /include | |
parent | 872e91dfc6e4903a9934a61a6f271d1020cf65b7 (diff) |
UPSTREAM next (v3.11): freezer: convert freezable helpers to freezer_do_not_count()
Freezing tasks will wake up almost every userspace task from
where it is blocking and force it to run until it hits a
call to try_to_sleep(), generally on the exit path from the syscall
it is blocking in. On resume each task will run again, usually
restarting the syscall and running until it hits the same
blocking call as it was originally blocked in.
Convert the existing wait_event_freezable* wrappers to use
freezer_do_not_count(). Combined with a previous patch,
these tasks will not run during suspend or resume unless they wake
up for another reason, in which case they will run until they hit
the try_to_freeze() in freezer_count(), and then continue processing
the wakeup after tasks are thawed.
This results in a small change in behavior, previously a race
between freezing and a normal wakeup would be won by the wakeup,
now the task will freeze and then handle the wakeup after thawing.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit b01235861b84c0f6107d3f9da189c9898fc3caaf)
Change-Id: I9465366abc897caed9067aa247987ccb96257c7d
Reviewed-on: http://git-master/r/228692
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Tested-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/freezer.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index d3c038ec9a88..00c3a73546d8 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -225,27 +225,19 @@ static inline bool freezer_should_skip(struct task_struct *p) #define wait_event_freezable(wq, condition) \ ({ \ int __retval; \ - for (;;) { \ - __retval = wait_event_interruptible(wq, \ - (condition) || freezing(current)); \ - if (__retval || (condition)) \ - break; \ - try_to_freeze(); \ - } \ + freezer_do_not_count(); \ + __retval = wait_event_interruptible(wq, (condition)); \ + freezer_count(); \ __retval; \ }) #define wait_event_freezable_timeout(wq, condition, timeout) \ ({ \ long __retval = timeout; \ - for (;;) { \ - __retval = wait_event_interruptible_timeout(wq, \ - (condition) || freezing(current), \ - __retval); \ - if (__retval <= 0 || (condition)) \ - break; \ - try_to_freeze(); \ - } \ + freezer_do_not_count(); \ + __retval = wait_event_interruptible_timeout(wq, (condition), \ + __retval); \ + freezer_count(); \ __retval; \ }) |