aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/delayacct.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/delayacct.h')
-rw-r--r--include/linux/delayacct.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 7e8b6011b8f3..561e2a77805c 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -55,14 +55,18 @@ static inline void delayacct_tsk_init(struct task_struct *tsk)
55{ 55{
56 /* reinitialize in case parent's non-null pointer was dup'ed*/ 56 /* reinitialize in case parent's non-null pointer was dup'ed*/
57 tsk->delays = NULL; 57 tsk->delays = NULL;
58 if (unlikely(delayacct_on)) 58 if (delayacct_on)
59 __delayacct_tsk_init(tsk); 59 __delayacct_tsk_init(tsk);
60} 60}
61 61
62static inline void delayacct_tsk_exit(struct task_struct *tsk) 62/* Free tsk->delays. Called from bad fork and __put_task_struct
63 * where there's no risk of tsk->delays being accessed elsewhere
64 */
65static inline void delayacct_tsk_free(struct task_struct *tsk)
63{ 66{
64 if (tsk->delays) 67 if (tsk->delays)
65 __delayacct_tsk_exit(tsk); 68 kmem_cache_free(delayacct_cache, tsk->delays);
69 tsk->delays = NULL;
66} 70}
67 71
68static inline void delayacct_blkio_start(void) 72static inline void delayacct_blkio_start(void)
@@ -80,9 +84,7 @@ static inline void delayacct_blkio_end(void)
80static inline int delayacct_add_tsk(struct taskstats *d, 84static inline int delayacct_add_tsk(struct taskstats *d,
81 struct task_struct *tsk) 85 struct task_struct *tsk)
82{ 86{
83 if (likely(!delayacct_on)) 87 if (!delayacct_on || !tsk->delays)
84 return -EINVAL;
85 if (!tsk->delays)
86 return 0; 88 return 0;
87 return __delayacct_add_tsk(d, tsk); 89 return __delayacct_add_tsk(d, tsk);
88} 90}
@@ -103,7 +105,7 @@ static inline void delayacct_init(void)
103{} 105{}
104static inline void delayacct_tsk_init(struct task_struct *tsk) 106static inline void delayacct_tsk_init(struct task_struct *tsk)
105{} 107{}
106static inline void delayacct_tsk_exit(struct task_struct *tsk) 108static inline void delayacct_tsk_free(struct task_struct *tsk)
107{} 109{}
108static inline void delayacct_blkio_start(void) 110static inline void delayacct_blkio_start(void)
109{} 111{}