Commit 8f0ab5147951267134612570604cf8341901a80c

Authored by Jay Lan
Committed by Linus Torvalds
1 parent 9acc185351

[PATCH] csa: convert CONFIG tag for extended accounting routines

There were a few accounting data/macros that are used in CSA but are #ifdef'ed
inside CONFIG_BSD_PROCESS_ACCT.  This patch is to change those ifdef's from
CONFIG_BSD_PROCESS_ACCT to CONFIG_TASK_XACCT.  A few defines are moved from
kernel/acct.c and include/linux/acct.h to kernel/tsacct.c and
include/linux/tsacct_kern.h.

Signed-off-by: Jay Lan <jlan@sgi.com>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jes Sorensen <jes@sgi.com>
Cc: Chris Sturtivant <csturtiv@sgi.com>
Cc: Tony Ernst <tee@sgi.com>
Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 10 changed files with 42 additions and 38 deletions Side-by-side Diff

... ... @@ -44,7 +44,7 @@
44 44 #include <linux/nfsd/syscall.h>
45 45 #include <linux/personality.h>
46 46 #include <linux/rwsem.h>
47   -#include <linux/acct.h>
  47 +#include <linux/tsacct_kern.h>
48 48 #include <linux/mm.h>
49 49  
50 50 #include <net/sock.h> /* siocdevprivate_ioctl */
... ... @@ -46,7 +46,7 @@
46 46 #include <linux/security.h>
47 47 #include <linux/syscalls.h>
48 48 #include <linux/rmap.h>
49   -#include <linux/acct.h>
  49 +#include <linux/tsacct_kern.h>
50 50 #include <linux/cn_proc.h>
51 51 #include <linux/audit.h>
52 52  
include/linux/acct.h
... ... @@ -124,16 +124,12 @@
124 124 extern void acct_init_pacct(struct pacct_struct *pacct);
125 125 extern void acct_collect(long exitcode, int group_dead);
126 126 extern void acct_process(void);
127   -extern void acct_update_integrals(struct task_struct *tsk);
128   -extern void acct_clear_integrals(struct task_struct *tsk);
129 127 #else
130 128 #define acct_auto_close_mnt(x) do { } while (0)
131 129 #define acct_auto_close(x) do { } while (0)
132 130 #define acct_init_pacct(x) do { } while (0)
133 131 #define acct_collect(x,y) do { } while (0)
134 132 #define acct_process() do { } while (0)
135   -#define acct_update_integrals(x) do { } while (0)
136   -#define acct_clear_integrals(task) do { } while (0)
137 133 #endif
138 134  
139 135 /*
include/linux/sched.h
... ... @@ -981,7 +981,7 @@
981 981 wait_queue_t *io_wait;
982 982 /* i/o counters(bytes read/written, #syscalls */
983 983 u64 rchar, wchar, syscr, syscw;
984   -#if defined(CONFIG_BSD_PROCESS_ACCT)
  984 +#if defined(CONFIG_TASK_XACCT)
985 985 u64 acct_rss_mem1; /* accumulated rss usage */
986 986 u64 acct_vm_mem1; /* accumulated virtual memory usage */
987 987 clock_t acct_stimexpd; /* clock_t-converted stime since last update */
include/linux/tsacct_kern.h
... ... @@ -18,8 +18,14 @@
18 18  
19 19 #ifdef CONFIG_TASK_XACCT
20 20 extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p);
  21 +extern void acct_update_integrals(struct task_struct *tsk);
  22 +extern void acct_clear_integrals(struct task_struct *tsk);
21 23 #else
22 24 static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
  25 +{}
  26 +static inline void acct_update_integrals(struct task_struct *tsk)
  27 +{}
  28 +static inline void acct_clear_integrals(struct task_struct *tsk)
23 29 {}
24 30 #endif /* CONFIG_TASK_XACCT */
25 31  
... ... @@ -602,34 +602,4 @@
602 602 do_acct_process(file);
603 603 fput(file);
604 604 }
605   -
606   -
607   -/**
608   - * acct_update_integrals - update mm integral fields in task_struct
609   - * @tsk: task_struct for accounting
610   - */
611   -void acct_update_integrals(struct task_struct *tsk)
612   -{
613   - if (likely(tsk->mm)) {
614   - long delta =
615   - cputime_to_jiffies(tsk->stime) - tsk->acct_stimexpd;
616   -
617   - if (delta == 0)
618   - return;
619   - tsk->acct_stimexpd = tsk->stime;
620   - tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
621   - tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
622   - }
623   -}
624   -
625   -/**
626   - * acct_clear_integrals - clear the mm integral fields in task_struct
627   - * @tsk: task_struct whose accounting fields are cleared
628   - */
629   -void acct_clear_integrals(struct task_struct *tsk)
630   -{
631   - tsk->acct_stimexpd = 0;
632   - tsk->acct_rss_mem1 = 0;
633   - tsk->acct_vm_mem1 = 0;
634   -}
... ... @@ -18,6 +18,7 @@
18 18 #include <linux/security.h>
19 19 #include <linux/cpu.h>
20 20 #include <linux/acct.h>
  21 +#include <linux/tsacct_kern.h>
21 22 #include <linux/file.h>
22 23 #include <linux/binfmts.h>
23 24 #include <linux/ptrace.h>
... ... @@ -42,6 +42,7 @@
42 42 #include <linux/profile.h>
43 43 #include <linux/rmap.h>
44 44 #include <linux/acct.h>
  45 +#include <linux/tsacct_kern.h>
45 46 #include <linux/cn_proc.h>
46 47 #include <linux/delayacct.h>
47 48 #include <linux/taskstats_kern.h>
... ... @@ -49,7 +49,7 @@
49 49 #include <linux/seq_file.h>
50 50 #include <linux/syscalls.h>
51 51 #include <linux/times.h>
52   -#include <linux/acct.h>
  52 +#include <linux/tsacct_kern.h>
53 53 #include <linux/kprobes.h>
54 54 #include <linux/delayacct.h>
55 55 #include <asm/tlb.h>
... ... @@ -88,5 +88,35 @@
88 88 stats->read_syscalls = p->syscr;
89 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 + */
  97 +void 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 + */
  115 +void 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 121 #endif