1c757249aSShailabh Nagar /* taskstats_kern.h - kernel header for per-task statistics interface 2c757249aSShailabh Nagar * 3c757249aSShailabh Nagar * Copyright (C) Shailabh Nagar, IBM Corp. 2006 4c757249aSShailabh Nagar * (C) Balbir Singh, IBM Corp. 2006 5c757249aSShailabh Nagar */ 6c757249aSShailabh Nagar 7c757249aSShailabh Nagar #ifndef _LINUX_TASKSTATS_KERN_H 8c757249aSShailabh Nagar #define _LINUX_TASKSTATS_KERN_H 9c757249aSShailabh Nagar 10c757249aSShailabh Nagar #include <linux/taskstats.h> 11c757249aSShailabh Nagar #include <linux/sched.h> 12c757249aSShailabh Nagar 13c757249aSShailabh Nagar enum { 14c757249aSShailabh Nagar TASKSTATS_MSG_UNICAST, /* send data only to requester */ 15c757249aSShailabh Nagar TASKSTATS_MSG_MULTICAST, /* send data to a group */ 16c757249aSShailabh Nagar }; 17c757249aSShailabh Nagar 18c757249aSShailabh Nagar #ifdef CONFIG_TASKSTATS 19c757249aSShailabh Nagar extern kmem_cache_t *taskstats_cache; 206f44993fSShailabh Nagar extern struct mutex taskstats_exit_mutex; 21c757249aSShailabh Nagar 22c757249aSShailabh Nagar static inline void taskstats_exit_alloc(struct taskstats **ptidstats, 23c757249aSShailabh Nagar struct taskstats **ptgidstats) 24c757249aSShailabh Nagar { 25c757249aSShailabh Nagar *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 26c757249aSShailabh Nagar *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 27c757249aSShailabh Nagar } 28c757249aSShailabh Nagar 29c757249aSShailabh Nagar static inline void taskstats_exit_free(struct taskstats *tidstats, 30c757249aSShailabh Nagar struct taskstats *tgidstats) 31c757249aSShailabh Nagar { 32c757249aSShailabh Nagar if (tidstats) 33c757249aSShailabh Nagar kmem_cache_free(taskstats_cache, tidstats); 34c757249aSShailabh Nagar if (tgidstats) 35c757249aSShailabh Nagar kmem_cache_free(taskstats_cache, tgidstats); 36c757249aSShailabh Nagar } 37c757249aSShailabh Nagar 38c757249aSShailabh Nagar extern void taskstats_exit_send(struct task_struct *, struct taskstats *, 39c757249aSShailabh Nagar struct taskstats *); 40c757249aSShailabh Nagar extern void taskstats_init_early(void); 41c757249aSShailabh Nagar 42c757249aSShailabh Nagar #else 43c757249aSShailabh Nagar static inline void taskstats_exit_alloc(struct taskstats **ptidstats, 44c757249aSShailabh Nagar struct taskstats **ptgidstats) 45c757249aSShailabh Nagar {} 46c757249aSShailabh Nagar static inline void taskstats_exit_free(struct taskstats *ptidstats, 47c757249aSShailabh Nagar struct taskstats *ptgidstats) 48c757249aSShailabh Nagar {} 49c757249aSShailabh Nagar static inline void taskstats_exit_send(struct task_struct *tsk, 50c757249aSShailabh Nagar struct taskstats *tidstats, 51c757249aSShailabh Nagar struct taskstats *tgidstats) 52c757249aSShailabh Nagar {} 53c757249aSShailabh Nagar static inline void taskstats_init_early(void) 54c757249aSShailabh Nagar {} 55c757249aSShailabh Nagar #endif /* CONFIG_TASKSTATS */ 56c757249aSShailabh Nagar 57c757249aSShailabh Nagar #endif 58c757249aSShailabh Nagar 59