diff options
Diffstat (limited to 'include/linux/taskstats_kern.h')
-rw-r--r-- | include/linux/taskstats_kern.h | 56 |
1 files changed, 5 insertions, 51 deletions
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h index 16894b7edcc8..7e9680f4afdd 100644 --- a/include/linux/taskstats_kern.h +++ b/include/linux/taskstats_kern.h | |||
@@ -12,73 +12,27 @@ | |||
12 | #include <net/genetlink.h> | 12 | #include <net/genetlink.h> |
13 | 13 | ||
14 | #ifdef CONFIG_TASKSTATS | 14 | #ifdef CONFIG_TASKSTATS |
15 | extern kmem_cache_t *taskstats_cache; | 15 | extern struct kmem_cache *taskstats_cache; |
16 | extern struct mutex taskstats_exit_mutex; | 16 | extern struct mutex taskstats_exit_mutex; |
17 | 17 | ||
18 | static inline void taskstats_exit_free(struct taskstats *tidstats) | ||
19 | { | ||
20 | if (tidstats) | ||
21 | kmem_cache_free(taskstats_cache, tidstats); | ||
22 | } | ||
23 | |||
24 | static inline void taskstats_tgid_init(struct signal_struct *sig) | 18 | static inline void taskstats_tgid_init(struct signal_struct *sig) |
25 | { | 19 | { |
26 | spin_lock_init(&sig->stats_lock); | ||
27 | sig->stats = NULL; | 20 | sig->stats = NULL; |
28 | } | 21 | } |
29 | 22 | ||
30 | static inline void taskstats_tgid_alloc(struct signal_struct *sig) | ||
31 | { | ||
32 | struct taskstats *stats; | ||
33 | unsigned long flags; | ||
34 | |||
35 | stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); | ||
36 | if (!stats) | ||
37 | return; | ||
38 | |||
39 | spin_lock_irqsave(&sig->stats_lock, flags); | ||
40 | if (!sig->stats) { | ||
41 | sig->stats = stats; | ||
42 | stats = NULL; | ||
43 | } | ||
44 | spin_unlock_irqrestore(&sig->stats_lock, flags); | ||
45 | |||
46 | if (stats) | ||
47 | kmem_cache_free(taskstats_cache, stats); | ||
48 | } | ||
49 | |||
50 | static inline void taskstats_tgid_free(struct signal_struct *sig) | 23 | static inline void taskstats_tgid_free(struct signal_struct *sig) |
51 | { | 24 | { |
52 | struct taskstats *stats = NULL; | 25 | if (sig->stats) |
53 | unsigned long flags; | 26 | kmem_cache_free(taskstats_cache, sig->stats); |
54 | |||
55 | spin_lock_irqsave(&sig->stats_lock, flags); | ||
56 | if (sig->stats) { | ||
57 | stats = sig->stats; | ||
58 | sig->stats = NULL; | ||
59 | } | ||
60 | spin_unlock_irqrestore(&sig->stats_lock, flags); | ||
61 | if (stats) | ||
62 | kmem_cache_free(taskstats_cache, stats); | ||
63 | } | 27 | } |
64 | 28 | ||
65 | extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); | 29 | extern void taskstats_exit(struct task_struct *, int group_dead); |
66 | extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int); | ||
67 | extern void taskstats_init_early(void); | 30 | extern void taskstats_init_early(void); |
68 | extern void taskstats_tgid_alloc(struct signal_struct *); | ||
69 | #else | 31 | #else |
70 | static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) | 32 | static inline void taskstats_exit(struct task_struct *tsk, int group_dead) |
71 | {} | ||
72 | static inline void taskstats_exit_free(struct taskstats *ptidstats) | ||
73 | {} | ||
74 | static inline void taskstats_exit_send(struct task_struct *tsk, | ||
75 | struct taskstats *tidstats, | ||
76 | int group_dead, unsigned int cpu) | ||
77 | {} | 33 | {} |
78 | static inline void taskstats_tgid_init(struct signal_struct *sig) | 34 | static inline void taskstats_tgid_init(struct signal_struct *sig) |
79 | {} | 35 | {} |
80 | static inline void taskstats_tgid_alloc(struct signal_struct *sig) | ||
81 | {} | ||
82 | static inline void taskstats_tgid_free(struct signal_struct *sig) | 36 | static inline void taskstats_tgid_free(struct signal_struct *sig) |
83 | {} | 37 | {} |
84 | static inline void taskstats_init_early(void) | 38 | static inline void taskstats_init_early(void) |