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; 20c757249aSShailabh Nagar 21c757249aSShailabh Nagar static inline void taskstats_exit_alloc(struct taskstats **ptidstats, 22c757249aSShailabh Nagar struct taskstats **ptgidstats) 23c757249aSShailabh Nagar { 24c757249aSShailabh Nagar *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 25c757249aSShailabh Nagar *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 26c757249aSShailabh Nagar } 27c757249aSShailabh Nagar 28c757249aSShailabh Nagar static inline void taskstats_exit_free(struct taskstats *tidstats, 29c757249aSShailabh Nagar struct taskstats *tgidstats) 30c757249aSShailabh Nagar { 31c757249aSShailabh Nagar if (tidstats) 32c757249aSShailabh Nagar kmem_cache_free(taskstats_cache, tidstats); 33c757249aSShailabh Nagar if (tgidstats) 34c757249aSShailabh Nagar kmem_cache_free(taskstats_cache, tgidstats); 35c757249aSShailabh Nagar } 36c757249aSShailabh Nagar 37c757249aSShailabh Nagar extern void taskstats_exit_send(struct task_struct *, struct taskstats *, 38c757249aSShailabh Nagar struct taskstats *); 39c757249aSShailabh Nagar extern void taskstats_init_early(void); 40c757249aSShailabh Nagar 41c757249aSShailabh Nagar #else 42c757249aSShailabh Nagar static inline void taskstats_exit_alloc(struct taskstats **ptidstats, 43c757249aSShailabh Nagar struct taskstats **ptgidstats) 44c757249aSShailabh Nagar {} 45c757249aSShailabh Nagar static inline void taskstats_exit_free(struct taskstats *ptidstats, 46c757249aSShailabh Nagar struct taskstats *ptgidstats) 47c757249aSShailabh Nagar {} 48c757249aSShailabh Nagar static inline void taskstats_exit_send(struct task_struct *tsk, 49c757249aSShailabh Nagar struct taskstats *tidstats, 50c757249aSShailabh Nagar struct taskstats *tgidstats) 51c757249aSShailabh Nagar {} 52c757249aSShailabh Nagar static inline void taskstats_init_early(void) 53c757249aSShailabh Nagar {} 54c757249aSShailabh Nagar #endif /* CONFIG_TASKSTATS */ 55c757249aSShailabh Nagar 56c757249aSShailabh Nagar #endif 57c757249aSShailabh Nagar 58