diff options
-rw-r--r-- | fs/compat.c | 2 | ||||
-rw-r--r-- | fs/exec.c | 2 | ||||
-rw-r--r-- | include/linux/acct.h | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | include/linux/tsacct_kern.h | 6 | ||||
-rw-r--r-- | kernel/acct.c | 30 | ||||
-rw-r--r-- | kernel/exit.c | 1 | ||||
-rw-r--r-- | kernel/fork.c | 1 | ||||
-rw-r--r-- | kernel/sched.c | 2 | ||||
-rw-r--r-- | kernel/tsacct.c | 30 |
10 files changed, 42 insertions, 38 deletions
diff --git a/fs/compat.c b/fs/compat.c index 6b90bf35f61..13fb08d096c 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/nfsd/syscall.h> | 44 | #include <linux/nfsd/syscall.h> |
45 | #include <linux/personality.h> | 45 | #include <linux/personality.h> |
46 | #include <linux/rwsem.h> | 46 | #include <linux/rwsem.h> |
47 | #include <linux/acct.h> | 47 | #include <linux/tsacct_kern.h> |
48 | #include <linux/mm.h> | 48 | #include <linux/mm.h> |
49 | 49 | ||
50 | #include <net/sock.h> /* siocdevprivate_ioctl */ | 50 | #include <net/sock.h> /* siocdevprivate_ioctl */ |
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/security.h> | 46 | #include <linux/security.h> |
47 | #include <linux/syscalls.h> | 47 | #include <linux/syscalls.h> |
48 | #include <linux/rmap.h> | 48 | #include <linux/rmap.h> |
49 | #include <linux/acct.h> | 49 | #include <linux/tsacct_kern.h> |
50 | #include <linux/cn_proc.h> | 50 | #include <linux/cn_proc.h> |
51 | #include <linux/audit.h> | 51 | #include <linux/audit.h> |
52 | 52 | ||
diff --git a/include/linux/acct.h b/include/linux/acct.h index e86bae7324d..0496d1f0995 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h | |||
@@ -124,16 +124,12 @@ extern void acct_auto_close(struct super_block *sb); | |||
124 | extern void acct_init_pacct(struct pacct_struct *pacct); | 124 | extern void acct_init_pacct(struct pacct_struct *pacct); |
125 | extern void acct_collect(long exitcode, int group_dead); | 125 | extern void acct_collect(long exitcode, int group_dead); |
126 | extern void acct_process(void); | 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 | #else | 127 | #else |
130 | #define acct_auto_close_mnt(x) do { } while (0) | 128 | #define acct_auto_close_mnt(x) do { } while (0) |
131 | #define acct_auto_close(x) do { } while (0) | 129 | #define acct_auto_close(x) do { } while (0) |
132 | #define acct_init_pacct(x) do { } while (0) | 130 | #define acct_init_pacct(x) do { } while (0) |
133 | #define acct_collect(x,y) do { } while (0) | 131 | #define acct_collect(x,y) do { } while (0) |
134 | #define acct_process() do { } while (0) | 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 | #endif | 133 | #endif |
138 | 134 | ||
139 | /* | 135 | /* |
diff --git a/include/linux/sched.h b/include/linux/sched.h index fc4a9873ec1..4ddeb0f982f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -981,7 +981,7 @@ struct task_struct { | |||
981 | wait_queue_t *io_wait; | 981 | wait_queue_t *io_wait; |
982 | /* i/o counters(bytes read/written, #syscalls */ | 982 | /* i/o counters(bytes read/written, #syscalls */ |
983 | u64 rchar, wchar, syscr, syscw; | 983 | u64 rchar, wchar, syscr, syscw; |
984 | #if defined(CONFIG_BSD_PROCESS_ACCT) | 984 | #if defined(CONFIG_TASK_XACCT) |
985 | u64 acct_rss_mem1; /* accumulated rss usage */ | 985 | u64 acct_rss_mem1; /* accumulated rss usage */ |
986 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ | 986 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ |
987 | clock_t acct_stimexpd; /* clock_t-converted stime since last update */ | 987 | clock_t acct_stimexpd; /* clock_t-converted stime since last update */ |
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h index 74102dcae67..7e50ac795b0 100644 --- a/include/linux/tsacct_kern.h +++ b/include/linux/tsacct_kern.h | |||
@@ -18,9 +18,15 @@ static inline void bacct_add_tsk(struct taskstats *stats, struct task_struct *ts | |||
18 | 18 | ||
19 | #ifdef CONFIG_TASK_XACCT | 19 | #ifdef CONFIG_TASK_XACCT |
20 | extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p); | 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 | #else | 23 | #else |
22 | static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) | 24 | static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) |
23 | {} | 25 | {} |
26 | static inline void acct_update_integrals(struct task_struct *tsk) | ||
27 | {} | ||
28 | static inline void acct_clear_integrals(struct task_struct *tsk) | ||
29 | {} | ||
24 | #endif /* CONFIG_TASK_XACCT */ | 30 | #endif /* CONFIG_TASK_XACCT */ |
25 | 31 | ||
26 | #endif | 32 | #endif |
diff --git a/kernel/acct.c b/kernel/acct.c index f4330acead4..0aad5ca36a8 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -602,33 +602,3 @@ void acct_process(void) | |||
602 | do_acct_process(file); | 602 | do_acct_process(file); |
603 | fput(file); | 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 | } | ||
diff --git a/kernel/exit.c b/kernel/exit.c index c189de2927a..3b47f26985f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/security.h> | 18 | #include <linux/security.h> |
19 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
20 | #include <linux/acct.h> | 20 | #include <linux/acct.h> |
21 | #include <linux/tsacct_kern.h> | ||
21 | #include <linux/file.h> | 22 | #include <linux/file.h> |
22 | #include <linux/binfmts.h> | 23 | #include <linux/binfmts.h> |
23 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
diff --git a/kernel/fork.c b/kernel/fork.c index 1c999f3e0b4..89f666491d1 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/profile.h> | 42 | #include <linux/profile.h> |
43 | #include <linux/rmap.h> | 43 | #include <linux/rmap.h> |
44 | #include <linux/acct.h> | 44 | #include <linux/acct.h> |
45 | #include <linux/tsacct_kern.h> | ||
45 | #include <linux/cn_proc.h> | 46 | #include <linux/cn_proc.h> |
46 | #include <linux/delayacct.h> | 47 | #include <linux/delayacct.h> |
47 | #include <linux/taskstats_kern.h> | 48 | #include <linux/taskstats_kern.h> |
diff --git a/kernel/sched.c b/kernel/sched.c index 74f169ac077..2bbd948f016 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include <linux/seq_file.h> | 49 | #include <linux/seq_file.h> |
50 | #include <linux/syscalls.h> | 50 | #include <linux/syscalls.h> |
51 | #include <linux/times.h> | 51 | #include <linux/times.h> |
52 | #include <linux/acct.h> | 52 | #include <linux/tsacct_kern.h> |
53 | #include <linux/kprobes.h> | 53 | #include <linux/kprobes.h> |
54 | #include <linux/delayacct.h> | 54 | #include <linux/delayacct.h> |
55 | #include <asm/tlb.h> | 55 | #include <asm/tlb.h> |
diff --git a/kernel/tsacct.c b/kernel/tsacct.c index 410483490cf..47c71daa416 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 | */ | ||
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 | #endif | 121 | #endif |