Skip to contentSkip to conversation

sched: Remove unused tryget_task_struct()

PATCH In review Zhan Xusheng 3 participants 3 messages Jul 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Remove unused tryget_task_struct()

tryget_task_struct() was added for sched_ext by commit a8532fac7b5d ("sched_ext: TASK_DEAD tasks must be switched into SCX on ops_enable"). All of its users in sched_ext were subsequently converted to get_task_struct() by commit fbe3fb103596 ("sched_ext: Replace tryget_task_struct() with get_task_struct()"), leaving the helper with no callers.

Remove the now-unused helper. No functional change.

---
 include/linux/sched/task.h | 5 -----
 1 file changed, 5 deletions(-)
include/linux/sched/task.h +0 -5
index 41ed884cffc9..1788bee1e39c 100644
@@ -117,11 +117,6 @@ static inline struct task_struct *get_task_struct(struct task_struct *t)
 	return t;
 }
 
-static inline struct task_struct *tryget_task_struct(struct task_struct *t)
-{
-	return refcount_inc_not_zero(&t->usage) ? t : NULL;
-}
-
 extern void __put_task_struct(struct task_struct *t);
 extern void __put_task_struct_rcu_cb(struct rcu_head *rhp);
 
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Zhan Xusheng

tryget_task_struct() was added for sched_ext by commit a8532fac7b5d ("sched_ext: TASK_DEAD tasks must be switched into SCX on ops_enable"). All of its users in sched_ext were subsequently converted to get_task_struct() by commit fbe3fb103596 ("sched_ext: Replace tryget_task_struct() with get_task_struct()"), leaving the helper with no callers.

Remove the now-unused helper. No functional change.

Thanks.

Signature · 1 line
tejun
Acked-by on v1 1/1
#2 lore raw
In reply to Zhan Xusheng
Quoted 11 lines · Zhan Xusheng

tryget_task_struct() was added for sched_ext by commit a8532fac7b5d ("sched_ext: TASK_DEAD tasks must be switched into SCX on ops_enable"). All of its users in sched_ext were subsequently converted to get_task_struct() by commit fbe3fb103596 ("sched_ext: Replace tryget_task_struct() with get_task_struct()"), leaving the helper with no callers.

Remove the now-unused helper. No functional change.