Skip to contentSkip to conversation

PM: Remove obsolete comment from unlock_system_sleep()

PATCH Applied Kevin Hao 2 participants 2 messages Dec 20, 2023

Subsystems (2)
lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH v2 1/1 PM: Remove obsolete comment from unlock_system_sleep()

With the freezer changes introduced by commit f5d39b020809 ("freezer,sched: Rewrite core freezer logic"), the comment in unlock_system_sleep() has become obsolete, there is no need to retain it.

---
v2: Remove the entire comment from unlock_system_sleep().

 kernel/power/main.c | 16 ----------------
 1 file changed, 16 deletions(-)
kernel/power/main.c +0 -16
index f6425ae3e8b0..b1ae9b677d03 100644
@@ -60,22 +60,6 @@ EXPORT_SYMBOL_GPL(lock_system_sleep);
 
 void unlock_system_sleep(unsigned int flags)
 {
-	/*
-	 * Don't use freezer_count() because we don't want the call to
-	 * try_to_freeze() here.
-	 *
-	 * Reason:
-	 * Fundamentally, we just don't need it, because freezing condition
-	 * doesn't come into effect until we release the
-	 * system_transition_mutex lock, since the freezer always works with
-	 * system_transition_mutex held.
-	 *
-	 * More importantly, in the case of hibernation,
-	 * unlock_system_sleep() gets called in snapshot_read() and
-	 * snapshot_write() when the freezing condition is still in effect.
-	 * Which means, if we use try_to_freeze() here, it would make them
-	 * enter the refrigerator, thus causing hibernation to lockup.
-	 */
 	if (!(flags & PF_NOFREEZE))
 		current->flags &= ~PF_NOFREEZE;
 	mutex_unlock(&system_transition_mutex);
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 31 lines · Kevin Hao

With the freezer changes introduced by commit f5d39b020809 ("freezer,sched: Rewrite core freezer logic"), the comment in unlock_system_sleep() has become obsolete, there is no need to retain it.

---
v2: Remove the entire comment from unlock_system_sleep().

 kernel/power/main.c | 16 ----------------
 1 file changed, 16 deletions(-)
kernel/power/main.c +0 -10
index f6425ae3e8b0..b1ae9b677d03 100644
@@ -60,22 +60,6 @@ EXPORT_SYMBOL_GPL(lock_system_sleep);
 
 void unlock_system_sleep(unsigned int flags)
 {
-       /*
-        * Don't use freezer_count() because we don't want the call to
-        * try_to_freeze() here.
-        *
-        * Reason:
-        * Fundamentally, we just don't need it, because freezing condition
-        * doesn't come into effect until we release the
-        * system_transition_mutex lock, since the freezer always works with
-        * system_transition_mutex held.
-        *

kernel/power/main.c EXPORT_SYMBOL_GPL(lock_system_sleep);

Quoted 10 lines
kernel/power/main.c +0 -7
-        * More importantly, in the case of hibernation,
-        * unlock_system_sleep() gets called in snapshot_read() and
-        * snapshot_write() when the freezing condition is still in effect.
-        * Which means, if we use try_to_freeze() here, it would make them
-        * enter the refrigerator, thus causing hibernation to lockup.
-        */
        if (!(flags & PF_NOFREEZE))
                current->flags &= ~PF_NOFREEZE;
        mutex_unlock(&system_transition_mutex);
--

Applied as 6.8 material, thanks!