summaryrefslogtreecommitdiffstats
path: root/kernel/tsacct.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/tsacct.c')
-rw-r--r--kernel/tsacct.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index d12e815b7bcd..f8e26ab963ed 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -126,20 +126,18 @@ static void __acct_update_integrals(struct task_struct *tsk,
126 cputime_t utime, cputime_t stime) 126 cputime_t utime, cputime_t stime)
127{ 127{
128 cputime_t time, dtime; 128 cputime_t time, dtime;
129 unsigned long flags;
130 u64 delta; 129 u64 delta;
131 130
132 if (!likely(tsk->mm)) 131 if (!likely(tsk->mm))
133 return; 132 return;
134 133
135 local_irq_save(flags);
136 time = stime + utime; 134 time = stime + utime;
137 dtime = time - tsk->acct_timexpd; 135 dtime = time - tsk->acct_timexpd;
138 /* Avoid division: cputime_t is often in nanoseconds already. */ 136 /* Avoid division: cputime_t is often in nanoseconds already. */
139 delta = cputime_to_nsecs(dtime); 137 delta = cputime_to_nsecs(dtime);
140 138
141 if (delta < TICK_NSEC) 139 if (delta < TICK_NSEC)
142 goto out; 140 return;
143 141
144 tsk->acct_timexpd = time; 142 tsk->acct_timexpd = time;
145 /* 143 /*
@@ -149,8 +147,6 @@ static void __acct_update_integrals(struct task_struct *tsk,
149 */ 147 */
150 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm) >> 10; 148 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm) >> 10;
151 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm >> 10; 149 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm >> 10;
152out:
153 local_irq_restore(flags);
154} 150}
155 151
156/** 152/**
@@ -160,9 +156,12 @@ out:
160void acct_update_integrals(struct task_struct *tsk) 156void acct_update_integrals(struct task_struct *tsk)
161{ 157{
162 cputime_t utime, stime; 158 cputime_t utime, stime;
159 unsigned long flags;
163 160
161 local_irq_save(flags);
164 task_cputime(tsk, &utime, &stime); 162 task_cputime(tsk, &utime, &stime);
165 __acct_update_integrals(tsk, utime, stime); 163 __acct_update_integrals(tsk, utime, stime);
164 local_irq_restore(flags);
166} 165}
167 166
168/** 167/**