aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/taskstats_kern.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/taskstats_kern.h')
-rw-r--r--include/linux/taskstats_kern.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 664224008fb2..6562a2050a25 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -23,28 +23,26 @@ static inline void taskstats_exit_free(struct taskstats *tidstats)
23 23
24static inline void taskstats_tgid_init(struct signal_struct *sig) 24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{ 25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL; 26 sig->stats = NULL;
28} 27}
29 28
30static inline void taskstats_tgid_alloc(struct signal_struct *sig) 29static inline void taskstats_tgid_alloc(struct task_struct *tsk)
31{ 30{
31 struct signal_struct *sig = tsk->signal;
32 struct taskstats *stats; 32 struct taskstats *stats;
33 unsigned long flags;
34 33
35 if (sig->stats != NULL) 34 if (sig->stats != NULL)
36 return; 35 return;
37 36
37 /* No problem if kmem_cache_zalloc() fails */
38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
39 if (!stats)
40 return;
41 39
42 spin_lock_irqsave(&sig->stats_lock, flags); 40 spin_lock_irq(&tsk->sighand->siglock);
43 if (!sig->stats) { 41 if (!sig->stats) {
44 sig->stats = stats; 42 sig->stats = stats;
45 stats = NULL; 43 stats = NULL;
46 } 44 }
47 spin_unlock_irqrestore(&sig->stats_lock, flags); 45 spin_unlock_irq(&tsk->sighand->siglock);
48 46
49 if (stats) 47 if (stats)
50 kmem_cache_free(taskstats_cache, stats); 48 kmem_cache_free(taskstats_cache, stats);
@@ -59,7 +57,6 @@ static inline void taskstats_tgid_free(struct signal_struct *sig)
59extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); 57extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
60extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int); 58extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
61extern void taskstats_init_early(void); 59extern void taskstats_init_early(void);
62extern void taskstats_tgid_alloc(struct signal_struct *);
63#else 60#else
64static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) 61static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
65{} 62{}
@@ -71,7 +68,7 @@ static inline void taskstats_exit_send(struct task_struct *tsk,
71{} 68{}
72static inline void taskstats_tgid_init(struct signal_struct *sig) 69static inline void taskstats_tgid_init(struct signal_struct *sig)
73{} 70{}
74static inline void taskstats_tgid_alloc(struct signal_struct *sig) 71static inline void taskstats_tgid_alloc(struct task_struct *tsk)
75{} 72{}
76static inline void taskstats_tgid_free(struct signal_struct *sig) 73static inline void taskstats_tgid_free(struct signal_struct *sig)
77{} 74{}