73 lines
2.2 KiB
Diff
73 lines
2.2 KiB
Diff
From e425c25dfad7a3a340eabca8b6aa7a878f3ac1ac Mon Sep 17 00:00:00 2001
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Tue, 31 May 2011 16:59:16 +0200
|
|
Subject: [PATCH 142/290] sched-delay-put-task.patch
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
---
|
|
include/linux/sched.h | 13 +++++++++++++
|
|
kernel/fork.c | 11 +++++++++++
|
|
2 files changed, 24 insertions(+)
|
|
|
|
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
|
index 5c3fa60..3134428 100644
|
|
--- a/include/linux/sched.h
|
|
+++ b/include/linux/sched.h
|
|
@@ -1595,6 +1595,9 @@ struct task_struct {
|
|
#ifdef CONFIG_HAVE_HW_BREAKPOINT
|
|
atomic_t ptrace_bp_refcnt;
|
|
#endif
|
|
+#ifdef CONFIG_PREEMPT_RT_BASE
|
|
+ struct rcu_head put_rcu;
|
|
+#endif
|
|
};
|
|
|
|
/* Future-safe accessor for struct task_struct's cpus_allowed. */
|
|
@@ -1779,6 +1782,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)
|
|
@@ -1786,6 +1798,7 @@ static inline void put_task_struct(struct task_struct *t)
|
|
if (atomic_dec_and_test(&t->usage))
|
|
__put_task_struct(t);
|
|
}
|
|
+#endif
|
|
|
|
extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
|
|
extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
|
|
diff --git a/kernel/fork.c b/kernel/fork.c
|
|
index ab30847..9bb21df 100644
|
|
--- a/kernel/fork.c
|
|
+++ b/kernel/fork.c
|
|
@@ -198,7 +198,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, rcu);
|
|
+
|
|
+ __put_task_struct(tsk);
|
|
+
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(__put_task_struct_cb);
|
|
+#endif
|
|
|
|
/*
|
|
* macro override instead of weak attribute alias, to workaround
|