aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/tsacct.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/tsacct.c')
-rw-r--r--kernel/tsacct.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 410483490cf6..47c71daa416f 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -88,4 +88,34 @@ void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
88 stats->read_syscalls = p->syscr; 88 stats->read_syscalls = p->syscr;
89 stats->write_syscalls = p->syscw; 89 stats->write_syscalls = p->syscw;
90} 90}
91
92
93/**
94 * acct_update_integrals - update mm integral fields in task_struct
95 * @tsk: task_struct for accounting
96 */
97void acct_update_integrals(struct task_struct *tsk)
98{
99 if (likely(tsk->mm)) {
100 long delta =
101 cputime_to_jiffies(tsk->stime) - tsk->acct_stimexpd;
102
103 if (delta == 0)
104 return;
105 tsk->acct_stimexpd = tsk->stime;
106 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
107 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
108 }
109}
110
111/**
112 * acct_clear_integrals - clear the mm integral fields in task_struct
113 * @tsk: task_struct whose accounting fields are cleared
114 */
115void acct_clear_integrals(struct task_struct *tsk)
116{
117 tsk->acct_stimexpd = 0;
118 tsk->acct_rss_mem1 = 0;
119 tsk->acct_vm_mem1 = 0;
120}
91#endif 121#endif