.. | .. |
---|
42 | 42 | #include <linux/hmm.h> |
---|
43 | 43 | #include <linux/fs.h> |
---|
44 | 44 | #include <linux/mm.h> |
---|
| 45 | +#include <linux/kprobes.h> |
---|
45 | 46 | #include <linux/vmacache.h> |
---|
46 | 47 | #include <linux/nsproxy.h> |
---|
47 | 48 | #include <linux/capability.h> |
---|
.. | .. |
---|
649 | 650 | } |
---|
650 | 651 | EXPORT_SYMBOL_GPL(__mmdrop); |
---|
651 | 652 | |
---|
| 653 | +#ifdef CONFIG_PREEMPT_RT_BASE |
---|
| 654 | +/* |
---|
| 655 | + * RCU callback for delayed mm drop. Not strictly rcu, but we don't |
---|
| 656 | + * want another facility to make this work. |
---|
| 657 | + */ |
---|
| 658 | +void __mmdrop_delayed(struct rcu_head *rhp) |
---|
| 659 | +{ |
---|
| 660 | + struct mm_struct *mm = container_of(rhp, struct mm_struct, delayed_drop); |
---|
| 661 | + |
---|
| 662 | + __mmdrop(mm); |
---|
| 663 | +} |
---|
| 664 | +#endif |
---|
| 665 | + |
---|
652 | 666 | static void mmdrop_async_fn(struct work_struct *work) |
---|
653 | 667 | { |
---|
654 | 668 | struct mm_struct *mm; |
---|
.. | .. |
---|
683 | 697 | if (atomic_dec_and_test(&sig->sigcnt)) |
---|
684 | 698 | free_signal_struct(sig); |
---|
685 | 699 | } |
---|
686 | | - |
---|
| 700 | +#ifdef CONFIG_PREEMPT_RT_BASE |
---|
| 701 | +static |
---|
| 702 | +#endif |
---|
687 | 703 | void __put_task_struct(struct task_struct *tsk) |
---|
688 | 704 | { |
---|
689 | 705 | WARN_ON(!tsk->exit_state); |
---|
690 | 706 | WARN_ON(atomic_read(&tsk->usage)); |
---|
691 | 707 | WARN_ON(tsk == current); |
---|
| 708 | + |
---|
| 709 | + /* |
---|
| 710 | + * Remove function-return probe instances associated with this |
---|
| 711 | + * task and put them back on the free list. |
---|
| 712 | + */ |
---|
| 713 | + kprobe_flush_task(tsk); |
---|
| 714 | + |
---|
| 715 | + /* Task is done with its stack. */ |
---|
| 716 | + put_task_stack(tsk); |
---|
692 | 717 | |
---|
693 | 718 | cgroup_free(tsk); |
---|
694 | 719 | task_numa_free(tsk, true); |
---|
.. | .. |
---|
700 | 725 | if (!profile_handoff_task(tsk)) |
---|
701 | 726 | free_task(tsk); |
---|
702 | 727 | } |
---|
| 728 | +#ifndef CONFIG_PREEMPT_RT_BASE |
---|
703 | 729 | EXPORT_SYMBOL_GPL(__put_task_struct); |
---|
| 730 | +#else |
---|
| 731 | +void __put_task_struct_cb(struct rcu_head *rhp) |
---|
| 732 | +{ |
---|
| 733 | + struct task_struct *tsk = container_of(rhp, struct task_struct, put_rcu); |
---|
| 734 | + |
---|
| 735 | + __put_task_struct(tsk); |
---|
| 736 | + |
---|
| 737 | +} |
---|
| 738 | +EXPORT_SYMBOL_GPL(__put_task_struct_cb); |
---|
| 739 | +#endif |
---|
704 | 740 | |
---|
705 | 741 | void __init __weak arch_task_cache_init(void) { } |
---|
706 | 742 | |
---|
.. | .. |
---|
863 | 899 | #ifdef CONFIG_STACKPROTECTOR |
---|
864 | 900 | tsk->stack_canary = get_random_canary(); |
---|
865 | 901 | #endif |
---|
| 902 | + if (orig->cpus_ptr == &orig->cpus_mask) |
---|
| 903 | + tsk->cpus_ptr = &tsk->cpus_mask; |
---|
866 | 904 | |
---|
867 | 905 | /* |
---|
868 | 906 | * One for us, one for whoever does the "release_task()" (usually |
---|
.. | .. |
---|
875 | 913 | tsk->splice_pipe = NULL; |
---|
876 | 914 | tsk->task_frag.page = NULL; |
---|
877 | 915 | tsk->wake_q.next = NULL; |
---|
| 916 | + tsk->wake_q_sleeper.next = NULL; |
---|
878 | 917 | |
---|
879 | 918 | account_kernel_stack(tsk, 1); |
---|
880 | 919 | |
---|
.. | .. |
---|
1600 | 1639 | */ |
---|
1601 | 1640 | static void posix_cpu_timers_init(struct task_struct *tsk) |
---|
1602 | 1641 | { |
---|
| 1642 | +#ifdef CONFIG_PREEMPT_RT_BASE |
---|
| 1643 | + tsk->posix_timer_list = NULL; |
---|
| 1644 | +#endif |
---|
1603 | 1645 | tsk->cputime_expires.prof_exp = 0; |
---|
1604 | 1646 | tsk->cputime_expires.virt_exp = 0; |
---|
1605 | 1647 | tsk->cputime_expires.sched_exp = 0; |
---|
.. | .. |
---|
1915 | 1957 | spin_lock_init(&p->alloc_lock); |
---|
1916 | 1958 | |
---|
1917 | 1959 | init_sigpending(&p->pending); |
---|
| 1960 | + p->sigqueue_cache = NULL; |
---|
1918 | 1961 | |
---|
1919 | 1962 | p->utime = p->stime = p->gtime = 0; |
---|
1920 | 1963 | #ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME |
---|