Skip to content

Commit b0f8c44

Browse files
colincrossrafaeljw
authored andcommitted
nanosleep: use freezable blocking call
Avoid waking up every thread sleeping in a nanosleep 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> Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 56467c7 commit b0f8c44

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎kernel/hrtimer.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <linux/sched/sysctl.h>
4848
#include <linux/sched/rt.h>
4949
#include <linux/timer.h>
50+
#include <linux/freezer.h>
5051

5152
#include <asm/uaccess.h>
5253

@@ -1545,7 +1546,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
15451546
t->task = NULL;
15461547

15471548
if (likely(t->task))
1548-
schedule();
1549+
freezable_schedule();
15491550

15501551
hrtimer_cancel(&t->timer);
15511552
mode = HRTIMER_MODE_ABS;

0 commit comments

Comments
 (0)