remove __put_task_struct_cb export again
Subsystems (3)
PATCH 1/1 remove __put_task_struct_cb export again
The patch '[PATCH] RCU signal handling' [1] added an export for __put_task_struct_cb, a put_task_struct helper newly introduced in that patch. But the put_task_struct couldn't be used modular previously as __put_task_struct wasn't exported. There are not callers of it in modular code, and it shouldn't be exported because we don't want drivers to hold references to task_structs.
This patch removes the export and folds __put_task_struct into __put_task_struct_cb as there's no other caller.
kernel/sched.c +0 -7
@@ -178,13 +178,6 @@#define task_hot (p, now, sd) ((long long) ((now) - (p)->last_ran) \ < (long long) (sd)->cache_hot_time) -void __put_task_struct_cb (struct rcu_head *rhp) -{ -__put_task_struct (container_of(rhp ,struct task_struct ,rcu )); -} - -EXPORT_SYMBOL_GPL (__put_task_struct_cb); -/* * These are the runqueue data structures: */
include/linux/sched.h +0 -1
@@ -892,7 +892,6 @@ }extern void free_task (struct task_struct *tsk); -extern void __put_task_struct (struct task_struct *tsk);#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0)extern void __put_task_struct_cb (struct rcu_head *rhp);
kernel/fork.c +3 -1
@@ -108,8 +108,10 @@ }EXPORT_SYMBOL (free_task); -void __put_task_struct (struct task_struct *tsk) +void __put_task_struct_cb (struct rcu_head *rhp) { + struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); +WARN_ON (!(tsk->exit_state & (EXIT_DEAD |EXIT_ZOMBIE )));WARN_ON (atomic_read (&tsk->usage));WARN_ON (tsk == current);
Quoted 11 lines · Christoph Hellwig
The patch '[PATCH] RCU signal handling' [1] added an export for
__put_task_struct_cb, aput_task_structhelper newly introduced in that patch. But theput_task_structcouldn't be used modular previously as__put_task_structwasn't exported. There are not callers of it in modular code, and it shouldn't be exported because we don't want drivers to hold references totask_structs.This patch removes the export and folds
__put_task_structinto__put_task_struct_cbas there's no other caller.
Good catch -- I missed the reference to __put_task_struct().
Passes some smoke tests on ppc64.
Thanx, Paul
Quoted 48 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/kernel/sched.c
===================================================================kernel/sched.c +0
-7@@ -178,13 +178,6 @@#define task_hot (p, now, sd) ((long long) ((now) - (p)->last_ran) \ < (long long) (sd)->cache_hot_time) -void __put_task_struct_cb (struct rcu_head *rhp) -{ -__put_task_struct (container_of(rhp ,struct task_struct ,rcu )); -} - -EXPORT_SYMBOL_GPL (__put_task_struct_cb); -/* * These are the runqueue data structures: */ Index:
linux-2.6/include/linux/sched.h
===================================================================include/linux/sched.h +0
-1@@ -892,7 +892,6 @@ }extern void free_task (struct task_struct *tsk); -extern void __put_task_struct (struct task_struct *tsk);#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0)extern void __put_task_struct_cb (struct rcu_head *rhp);Index:
linux-2.6/kernel/fork.c
===================================================================kernel/fork.c +3
-1@@ -108,8 +108,10 @@ }EXPORT_SYMBOL (free_task); -void __put_task_struct (struct task_struct *tsk) +void __put_task_struct_cb (struct rcu_head *rhp) { + struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); +WARN_ON (!(tsk->exit_state & (EXIT_DEAD |EXIT_ZOMBIE )));WARN_ON (atomic_read (&tsk->usage));WARN_ON (tsk == current);