|
@@ -110,6 +110,18 @@ bool freeze_task(struct task_struct *p)
|
|
|
{
|
|
|
unsigned long flags;
|
|
|
|
|
|
+ /*
|
|
|
+ * This check can race with freezer_do_not_count, but worst case that
|
|
|
+ * will result in an extra wakeup being sent to the task. It does not
|
|
|
+ * race with freezer_count(), the barriers in freezer_count() and
|
|
|
+ * freezer_should_skip() ensure that either freezer_count() sees
|
|
|
+ * freezing == true in try_to_freeze() and freezes, or
|
|
|
+ * freezer_should_skip() sees !PF_FREEZE_SKIP and freezes the task
|
|
|
+ * normally.
|
|
|
+ */
|
|
|
+ if (freezer_should_skip(p))
|
|
|
+ return false;
|
|
|
+
|
|
|
spin_lock_irqsave(&freezer_lock, flags);
|
|
|
if (!freezing(p) || frozen(p)) {
|
|
|
spin_unlock_irqrestore(&freezer_lock, flags);
|