]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - kernel/fork.c
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / kernel / fork.c
index 997ac1d584f76b0e42551975bdae960e61c0807e..ae21c51e50afcc01f621abdb30514a3acc8880bd 100644 (file)
@@ -76,6 +76,7 @@
 #include <linux/compiler.h>
 #include <linux/sysctl.h>
 #include <linux/kcov.h>
+#include <linux/kprobes.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -376,13 +377,24 @@ 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);
        WARN_ON(atomic_read(&tsk->usage));
        WARN_ON(tsk == current);
 
+       /*
+        * Remove function-return probe instances associated with this
+        * task and put them back on the free list.
+        */
+       kprobe_flush_task(tsk);
+
+       /* Task is done with its stack. */
+       put_task_stack(tsk);
+
        cgroup_free(tsk);
        task_numa_free(tsk);
        security_task_free(tsk);
@@ -393,7 +405,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) { }
 
@@ -849,6 +872,19 @@ void __mmdrop(struct mm_struct *mm)
 }
 EXPORT_SYMBOL_GPL(__mmdrop);
 
+#ifdef CONFIG_PREEMPT_RT_BASE
+/*
+ * RCU callback for delayed mm drop. Not strictly rcu, but we don't
+ * want another facility to make this work.
+ */
+void __mmdrop_delayed(struct rcu_head *rhp)
+{
+       struct mm_struct *mm = container_of(rhp, struct mm_struct, delayed_drop);
+
+       __mmdrop(mm);
+}
+#endif
+
 static inline void __mmput(struct mm_struct *mm)
 {
        VM_BUG_ON(atomic_read(&mm->mm_users));
@@ -1423,6 +1459,9 @@ static void rt_mutex_init_task(struct task_struct *p)
  */
 static void posix_cpu_timers_init(struct task_struct *tsk)
 {
+#ifdef CONFIG_PREEMPT_RT_BASE
+       tsk->posix_timer_list = NULL;
+#endif
        tsk->cputime_expires.prof_exp = 0;
        tsk->cputime_expires.virt_exp = 0;
        tsk->cputime_expires.sched_exp = 0;
@@ -1549,6 +1588,7 @@ static __latent_entropy struct task_struct *copy_process(
        spin_lock_init(&p->alloc_lock);
 
        init_sigpending(&p->pending);
+       p->sigqueue_cache = NULL;
 
        p->utime = p->stime = p->gtime = 0;
        p->utimescaled = p->stimescaled = 0;