1 /* taskstats_kern.h - kernel header for per-task statistics interface
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
7 #ifndef _LINUX_TASKSTATS_KERN_H
8 #define _LINUX_TASKSTATS_KERN_H
10 #include <linux/taskstats.h>
11 #include <linux/sched.h>
12 #include <net/genetlink.h>
14 #ifdef CONFIG_TASKSTATS
15 extern kmem_cache_t
*taskstats_cache
;
16 extern struct mutex taskstats_exit_mutex
;
18 static inline void taskstats_exit_free(struct taskstats
*tidstats
)
21 kmem_cache_free(taskstats_cache
, tidstats
);
24 static inline void taskstats_tgid_init(struct signal_struct
*sig
)
26 spin_lock_init(&sig
->stats_lock
);
30 static inline void taskstats_tgid_alloc(struct signal_struct
*sig
)
32 struct taskstats
*stats
;
35 stats
= kmem_cache_zalloc(taskstats_cache
, SLAB_KERNEL
);
39 spin_lock_irqsave(&sig
->stats_lock
, flags
);
44 spin_unlock_irqrestore(&sig
->stats_lock
, flags
);
47 kmem_cache_free(taskstats_cache
, stats
);
50 static inline void taskstats_tgid_free(struct signal_struct
*sig
)
52 struct taskstats
*stats
= NULL
;
55 spin_lock_irqsave(&sig
->stats_lock
, flags
);
60 spin_unlock_irqrestore(&sig
->stats_lock
, flags
);
62 kmem_cache_free(taskstats_cache
, stats
);
65 extern void taskstats_exit_alloc(struct taskstats
**, unsigned int *);
66 extern void taskstats_exit_send(struct task_struct
*, struct taskstats
*, int, unsigned int);
67 extern void taskstats_init_early(void);
68 extern void taskstats_tgid_alloc(struct signal_struct
*);
70 static inline void taskstats_exit_alloc(struct taskstats
**ptidstats
, unsigned int *mycpu
)
72 static inline void taskstats_exit_free(struct taskstats
*ptidstats
)
74 static inline void taskstats_exit_send(struct task_struct
*tsk
,
75 struct taskstats
*tidstats
,
76 int group_dead
, unsigned int cpu
)
78 static inline void taskstats_tgid_init(struct signal_struct
*sig
)
80 static inline void taskstats_tgid_alloc(struct signal_struct
*sig
)
82 static inline void taskstats_tgid_free(struct signal_struct
*sig
)
84 static inline void taskstats_init_early(void)
86 #endif /* CONFIG_TASKSTATS */