Skip to contentSkip to conversation

x86/sgx: Remove unnecessary try_to_freeze()

PATCH In review Kevin Hao 2 participants 2 messages Dec 13, 2023

Subsystems (2)
lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH 1/1 x86/sgx: Remove unnecessary try_to_freeze()

A freezable kernel thread can enter frozen state during freezing by either calling try_to_freeze() or using wait_event_freezable() and its variants. However, there is no need to use both methods simultaneously.

Cc Jarkko Sakkinen <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Pavel Machek <[email protected]>
---
 arch/x86/kernel/cpu/sgx/main.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/sgx/main.c +0 -3
index 166692f2d501..318165b3ff78 100644
@@ -404,9 +404,6 @@ static int ksgxd(void *p)
 	WARN_ON(__sgx_sanitize_pages(&sgx_dirty_page_list));
 
 	while (!kthread_should_stop()) {
-		if (try_to_freeze())
-			continue;
-
 		wait_event_freezable(ksgxd_waitq,
 				     kthread_should_stop() ||
 				     sgx_should_reclaim(SGX_NR_HIGH_PAGES));
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Kevin Hao

A freezable kernel thread can enter frozen state during freezing by either calling try_to_freeze() or using wait_event_freezable() and its variants. However, there is no need to use both methods simultaneously.

Cc Jarkko Sakkinen <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Pavel Machek <[email protected]>
---
 arch/x86/kernel/cpu/sgx/main.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/sgx/main.c +0 -0
index 166692f2d501..318165b3ff78 100644

arch/x86/kernel/cpu/sgx/main.c static int ksgxd(void *p) · line 409

Quoted 9 lines
arch/x86/kernel/cpu/sgx/main.c +0 -3
@@ -404,9 +404,6 @@ static int ksgxd(void *p)
 	WARN_ON(__sgx_sanitize_pages(&sgx_dirty_page_list));
 
 	while (!kthread_should_stop()) {
-		if (try_to_freeze())
-			continue;
-
 		wait_event_freezable(ksgxd_waitq,
 				     kthread_should_stop() ||
 				     sgx_should_reclaim(SGX_NR_HIGH_PAGES));