Skip to content

Commit 56467c7

Browse files
colincrossrafaeljw
authored andcommitted
futex: use freezable blocking call
Avoid waking up every thread sleeping in a futex_wait call during suspend and resume by calling a freezable blocking call. Previous patches modified the freezer to avoid sending wakeups to threads that are blocked in freezable blocking calls. This call was selected to be converted to a freezable call because it doesn't hold any locks or release any resources when interrupted that might be needed by another freezing task or a kernel driver during suspend, and is a common site where idle userspace tasks are blocked. Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 9745cdb commit 56467c7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎kernel/futex.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include <linux/nsproxy.h>
6262
#include <linux/ptrace.h>
6363
#include <linux/sched/rt.h>
64+
#include <linux/freezer.h>
6465

6566
#include <asm/futex.h>
6667

@@ -1807,7 +1808,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
18071808
* is no timeout, or if it has yet to expire.
18081809
*/
18091810
if (!timeout || timeout->task)
1810-
schedule();
1811+
freezable_schedule();
18111812
}
18121813
__set_current_state(TASK_RUNNING);
18131814
}

0 commit comments

Comments
 (0)