diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-05-31 14:59:16 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-10 00:19:09 (GMT) |
commit | 0a1feb80217e70570ad262944432999c915ef89c (patch) | |
tree | 6498f4db6ae968e015d7e65b37770a7134521683 | |
parent | 35f715cc8726108d325aa563587eb5d8a9b32d91 (diff) | |
download | linux-fsl-qoriq-0a1feb80217e70570ad262944432999c915ef89c.tar.xz |
sched-delay-put-task.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/sched.h | 13 | ||||
-rw-r--r-- | kernel/fork.c | 15 |
2 files changed, 27 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index a6dc6b6..cf866a5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1430,6 +1430,9 @@ struct task_struct { unsigned int sequential_io; unsigned int sequential_io_avg; #endif +#ifdef CONFIG_PREEMPT_RT_BASE + struct rcu_head put_rcu; +#endif }; /* Future-safe accessor for struct task_struct's cpus_allowed. */ @@ -1593,6 +1596,15 @@ extern struct pid *cad_pid; extern void free_task(struct task_struct *tsk); #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) +#ifdef CONFIG_PREEMPT_RT_BASE +extern void __put_task_struct_cb(struct rcu_head *rhp); + +static inline void put_task_struct(struct task_struct *t) +{ + if (atomic_dec_and_test(&t->usage)) + call_rcu(&t->put_rcu, __put_task_struct_cb); +} +#else extern void __put_task_struct(struct task_struct *t); static inline void put_task_struct(struct task_struct *t) @@ -1600,6 +1612,7 @@ static inline void put_task_struct(struct task_struct *t) if (atomic_dec_and_test(&t->usage)) __put_task_struct(t); } +#endif #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN extern void task_cputime(struct task_struct *t, diff --git a/kernel/fork.c b/kernel/fork.c index 3ac5af8..d1e28a3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -230,7 +230,9 @@ static inline void put_signal_struct(struct signal_struct *sig) if (atomic_dec_and_test(&sig->sigcnt)) free_signal_struct(sig); } - +#ifdef CONFIG_PREEMPT_RT_BASE +static +#endif void __put_task_struct(struct task_struct *tsk) { WARN_ON(!tsk->exit_state); @@ -245,7 +247,18 @@ void __put_task_struct(struct task_struct *tsk) if (!profile_handoff_task(tsk)) free_task(tsk); } +#ifndef CONFIG_PREEMPT_RT_BASE EXPORT_SYMBOL_GPL(__put_task_struct); +#else +void __put_task_struct_cb(struct rcu_head *rhp) +{ + struct task_struct *tsk = container_of(rhp, struct task_struct, put_rcu); + + __put_task_struct(tsk); + +} +EXPORT_SYMBOL_GPL(__put_task_struct_cb); +#endif void __init __weak arch_task_cache_init(void) { } |