Skip to contentSkip to conversation

locking/mutex: remove redundant ifdef

PATCH Applied [email protected] 4 participants 4 messages Jul 4, 2025 – Jul 19, 2025 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locking/mutex: remove redundant ifdef

From: Ran Xiaokai <[email protected]>

hung_task_set/clear_blocker() is already guarded by CONFIG_DETECT_HUNG_TASK_BLOCKER in hung_task.h, So remove the redudant check of #ifdef.

---
 kernel/locking/mutex.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/locking/mutex.c +0 -4
index a39ecccbd106..d4210dc97b6a 100644
@@ -191,9 +191,7 @@ static void
 __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
 		   struct list_head *list)
 {
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
 	hung_task_set_blocker(lock, BLOCKER_TYPE_MUTEX);
-#endif
 	debug_mutex_add_waiter(lock, waiter, current);
 
 	list_add_tail(&waiter->list, list);
@@ -209,9 +207,7 @@ __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter)
 		__mutex_clear_flag(lock, MUTEX_FLAGS);
 
 	debug_mutex_remove_waiter(lock, waiter, current);
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
 	hung_task_clear_blocker();
-#endif
 }
 
 /*
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 26 lines · On 7/3/25 9:52 PM, [email protected] wrote:

From: Ran Xiaokai <[email protected]>

hung_task_set/clear_blocker() is already guarded by CONFIG_DETECT_HUNG_TASK_BLOCKER in hung_task.h, So remove the redudant check of #ifdef.

---
  kernel/locking/mutex.c | 4 ----
  1 file changed, 4 deletions(-)
kernel/locking/mutex.c +0 -2
index a39ecccbd106..d4210dc97b6a 100644
@@ -191,9 +191,7 @@ static void
  __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
  		   struct list_head *list)
  {
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
  	hung_task_set_blocker(lock, BLOCKER_TYPE_MUTEX);
-#endif
  	debug_mutex_add_waiter(lock, waiter, current);
 
  	list_add_tail(&waiter->list, list);

kernel/locking/mutex.c __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter) · line 213

Quoted 9 lines
kernel/locking/mutex.c +0 -2
@@ -209,9 +207,7 @@ __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter)
  		__mutex_clear_flag(lock, MUTEX_FLAGS);
 
  	debug_mutex_remove_waiter(lock, waiter, current);
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
  	hung_task_clear_blocker();
-#endif
  }
 
  /*
Applied
#2 lore raw
Quoted 9 lines · Waiman Long
Quoted 7 lines · On 7/3/25 9:52 PM, [email protected] wrote:

From: Ran Xiaokai <[email protected]>

hung_task_set/clear_blocker() is already guarded by CONFIG_DETECT_HUNG_TASK_BLOCKER in hung_task.h, So remove the redudant check of #ifdef.

Queued for v6.17, thanks!

Regards,
Boqun

Quoted 27 lines
Quoted 18 lines
---
  kernel/locking/mutex.c | 4 ----
  1 file changed, 4 deletions(-)
kernel/locking/mutex.c +0 -2
index a39ecccbd106..d4210dc97b6a 100644
@@ -191,9 +191,7 @@ static void
  __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
  		   struct list_head *list)
  {
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
  	hung_task_set_blocker(lock, BLOCKER_TYPE_MUTEX);
-#endif
  	debug_mutex_add_waiter(lock, waiter, current);
  	list_add_tail(&waiter->list, list);

kernel/locking/mutex.c __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter) · line 211

Quoted 7 lines
kernel/locking/mutex.c +0 -2
@@ -209,9 +207,7 @@ __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter)
  		__mutex_clear_flag(lock, MUTEX_FLAGS);
  	debug_mutex_remove_waiter(lock, waiter, current);
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
  	hung_task_clear_blocker();
-#endif
  }
  /*
merge bot Applied
#3 lore raw

[tip: locking/core] locking/mutex: Remove redundant #ifdefs

In reply to [email protected]
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     1dfe5ea6dbb3e03073f5426d65394694683b8692
Gitweb:        https://git.kernel.org/tip/1dfe5ea6dbb3e03073f5426d65394694683b8692
Author:        Ran Xiaokai <[email protected]>
AuthorDate:    Fri, 04 Jul 2025 01:52:18 
Committer:     Boqun Feng <[email protected]>
CommitterDate: Mon, 14 Jul 2025 21:57:29 -07:00

locking/mutex: Remove redundant #ifdefs

hung_task_{set,clear}_blocker() is already guarded by CONFIG_DETECT_HUNG_TASK_BLOCKER in hung_task.h, So remove the redudant check of #ifdef.

---
 kernel/locking/mutex.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/locking/mutex.c +0 -4
index a39eccc..d4210dc 100644
@@ -191,9 +191,7 @@ static void
 __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
 		   struct list_head *list)
 {
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
 	hung_task_set_blocker(lock, BLOCKER_TYPE_MUTEX);
-#endif
 	debug_mutex_add_waiter(lock, waiter, current);
 
 	list_add_tail(&waiter->list, list);
@@ -209,9 +207,7 @@ __mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter)
 		__mutex_clear_flag(lock, MUTEX_FLAGS);
 
 	debug_mutex_remove_waiter(lock, waiter, current);
-#ifdef CONFIG_DETECT_HUNG_TASK_BLOCKER
 	hung_task_clear_blocker();
-#endif
 }
 
 /*