aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-12-01 16:44:39 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-06 16:12:27 -0500
commitd310310cbff18ec385c6ab4d58f33b100192a96a (patch)
tree801dbbef1552256e7cefc7ec08dcd41b30a9930b /include/linux/freezer.h
parent62c9ea6b120688d800b4d892eaf737c20a73e86b (diff)
Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer
Allow the freezer to skip wait_on_bit_killable sleeps in the sunrpc layer. This should allow suspend and hibernate events to proceed, even when there are RPC's pending on the wire. Also, wrap the TASK_KILLABLE sleeps in NFS layer in freezer_do_not_count and freezer_count calls. This allows the freezer to skip tasks that are sleeping while looping on EJUKEBOX or NFS4ERR_DELAY sorts of errors. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index c1ee2833655e..30f06c220467 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -105,6 +105,29 @@ static inline int freezer_should_skip(struct task_struct *p)
105} 105}
106 106
107/* 107/*
108 * These macros are intended to be used whenever you want allow a task that's
109 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
110 * that neither return any clear indication of whether a freeze event happened
111 * while in this function.
112 */
113
114/* Like schedule(), but should not block the freezer. */
115#define freezable_schedule() \
116({ \
117 freezer_do_not_count(); \
118 schedule(); \
119 freezer_count(); \
120})
121
122/* Like schedule_timeout_killable(), but should not block the freezer. */
123#define freezable_schedule_timeout_killable(timeout) \
124({ \
125 freezer_do_not_count(); \
126 schedule_timeout_killable(timeout); \
127 freezer_count(); \
128})
129
130/*
108 * Freezer-friendly wrappers around wait_event_interruptible(), 131 * Freezer-friendly wrappers around wait_event_interruptible(),
109 * wait_event_killable() and wait_event_interruptible_timeout(), originally 132 * wait_event_killable() and wait_event_interruptible_timeout(), originally
110 * defined in <linux/wait.h> 133 * defined in <linux/wait.h>
@@ -163,6 +186,11 @@ static inline void freezer_count(void) {}
163static inline int freezer_should_skip(struct task_struct *p) { return 0; } 186static inline int freezer_should_skip(struct task_struct *p) { return 0; }
164static inline void set_freezable(void) {} 187static inline void set_freezable(void) {}
165 188
189#define freezable_schedule() schedule()
190
191#define freezable_schedule_timeout_killable(timeout) \
192 schedule_timeout_killable(timeout)
193
166#define wait_event_freezable(wq, condition) \ 194#define wait_event_freezable(wq, condition) \
167 wait_event_interruptible(wq, condition) 195 wait_event_interruptible(wq, condition)
168 196