|
@@ -104,6 +104,29 @@ static inline int freezer_should_skip(struct task_struct *p)
|
|
|
return !!(p->flags & PF_FREEZER_SKIP);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * These macros are intended to be used whenever you want allow a task that's
|
|
|
+ * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
|
|
|
+ * that neither return any clear indication of whether a freeze event happened
|
|
|
+ * while in this function.
|
|
|
+ */
|
|
|
+
|
|
|
+/* Like schedule(), but should not block the freezer. */
|
|
|
+#define freezable_schedule() \
|
|
|
+({ \
|
|
|
+ freezer_do_not_count(); \
|
|
|
+ schedule(); \
|
|
|
+ freezer_count(); \
|
|
|
+})
|
|
|
+
|
|
|
+/* Like schedule_timeout_killable(), but should not block the freezer. */
|
|
|
+#define freezable_schedule_timeout_killable(timeout) \
|
|
|
+({ \
|
|
|
+ freezer_do_not_count(); \
|
|
|
+ schedule_timeout_killable(timeout); \
|
|
|
+ freezer_count(); \
|
|
|
+})
|
|
|
+
|
|
|
/*
|
|
|
* Freezer-friendly wrappers around wait_event_interruptible(),
|
|
|
* wait_event_killable() and wait_event_interruptible_timeout(), originally
|
|
@@ -163,6 +186,11 @@ static inline void freezer_count(void) {}
|
|
|
static inline int freezer_should_skip(struct task_struct *p) { return 0; }
|
|
|
static inline void set_freezable(void) {}
|
|
|
|
|
|
+#define freezable_schedule() schedule()
|
|
|
+
|
|
|
+#define freezable_schedule_timeout_killable(timeout) \
|
|
|
+ schedule_timeout_killable(timeout)
|
|
|
+
|
|
|
#define wait_event_freezable(wq, condition) \
|
|
|
wait_event_interruptible(wq, condition)
|
|
|
|