From 8067a41a8edf4299209b543e41b8910eb06ef486 Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Sun, 25 Jun 2006 05:49:26 -0700 Subject: [PATCH] --- yaml --- r: 29822 b: refs/heads/master c: 77787bfb44da6e6166af088226707aeccee27968 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/sched.h | 2 ++ trunk/kernel/acct.c | 24 +++++++++++------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 1657b20d8a90..cf571aa046d2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f6ec29a42d7ac3b309a9cef179b686d23986ab98 +refs/heads/master: 77787bfb44da6e6166af088226707aeccee27968 diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index d8429dc250f0..8d11d9310db0 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -362,6 +362,8 @@ struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; + cputime_t ac_utime, ac_stime; + unsigned long ac_minflt, ac_majflt; }; /* diff --git a/trunk/kernel/acct.c b/trunk/kernel/acct.c index 4c85fdf615da..368c4f03fe0e 100644 --- a/trunk/kernel/acct.c +++ b/trunk/kernel/acct.c @@ -428,7 +428,6 @@ static void do_acct_process(struct file *file) u64 elapsed; u64 run_time; struct timespec uptime; - unsigned long jiffies; /* * First check to see if there is enough free_space to continue @@ -469,12 +468,6 @@ static void do_acct_process(struct file *file) #endif do_div(elapsed, AHZ); ac.ac_btime = xtime.tv_sec - elapsed; - jiffies = cputime_to_jiffies(cputime_add(current->utime, - current->signal->utime)); - ac.ac_utime = encode_comp_t(jiffies_to_AHZ(jiffies)); - jiffies = cputime_to_jiffies(cputime_add(current->stime, - current->signal->stime)); - ac.ac_stime = encode_comp_t(jiffies_to_AHZ(jiffies)); /* we really need to bite the bullet and change layout */ ac.ac_uid = current->uid; ac.ac_gid = current->gid; @@ -497,16 +490,16 @@ static void do_acct_process(struct file *file) read_unlock(&tasklist_lock); spin_lock(¤t->sighand->siglock); + ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime))); + ac.ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime))); ac.ac_flag = pacct->ac_flag; ac.ac_mem = encode_comp_t(pacct->ac_mem); + ac.ac_minflt = encode_comp_t(pacct->ac_minflt); + ac.ac_majflt = encode_comp_t(pacct->ac_majflt); ac.ac_exitcode = pacct->ac_exitcode; spin_unlock(¤t->sighand->siglock); ac.ac_io = encode_comp_t(0 /* current->io_usage */); /* %% */ ac.ac_rw = encode_comp_t(ac.ac_io / 1024); - ac.ac_minflt = encode_comp_t(current->signal->min_flt + - current->min_flt); - ac.ac_majflt = encode_comp_t(current->signal->maj_flt + - current->maj_flt); ac.ac_swaps = encode_comp_t(0); /* @@ -532,6 +525,7 @@ static void do_acct_process(struct file *file) void acct_init_pacct(struct pacct_struct *pacct) { memset(pacct, 0, sizeof(struct pacct_struct)); + pacct->ac_utime = pacct->ac_stime = cputime_zero; } /** @@ -555,7 +549,7 @@ void acct_collect(long exitcode, int group_dead) up_read(¤t->mm->mmap_sem); } - spin_lock(¤t->sighand->siglock); + spin_lock_irq(¤t->sighand->siglock); if (group_dead) pacct->ac_mem = vsize / 1024; if (thread_group_leader(current)) { @@ -569,7 +563,11 @@ void acct_collect(long exitcode, int group_dead) pacct->ac_flag |= ACORE; if (current->flags & PF_SIGNALED) pacct->ac_flag |= AXSIG; - spin_unlock(¤t->sighand->siglock); + pacct->ac_utime = cputime_add(pacct->ac_utime, current->utime); + pacct->ac_stime = cputime_add(pacct->ac_stime, current->stime); + pacct->ac_minflt += current->min_flt; + pacct->ac_majflt += current->maj_flt; + spin_unlock_irq(¤t->sighand->siglock); } /**