diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-19 20:10:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-19 20:10:57 -0400 |
commit | 58c3c3aa01b455ecb99d61ce73f1444274af696b (patch) | |
tree | 0c79541bfd948b06923780d8c651e83b1b6b5822 /kernel/tsacct.c | |
parent | 1a51410abe7d0ee4b1d112780f46df87d3621043 (diff) |
Make taskstats round statistics down to nearest 1k bytes/events
Even with just the interface limited to admin, there really is little to
reason to give byte-per-byte counts for taskstats. So round it down to
something less intrusive.
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/tsacct.c')
-rw-r--r-- | kernel/tsacct.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/tsacct.c b/kernel/tsacct.c index 24dc60d9fa1f..5bbfac85866e 100644 --- a/kernel/tsacct.c +++ b/kernel/tsacct.c | |||
@@ -78,6 +78,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk) | |||
78 | 78 | ||
79 | #define KB 1024 | 79 | #define KB 1024 |
80 | #define MB (1024*KB) | 80 | #define MB (1024*KB) |
81 | #define KB_MASK (~(KB-1)) | ||
81 | /* | 82 | /* |
82 | * fill in extended accounting fields | 83 | * fill in extended accounting fields |
83 | */ | 84 | */ |
@@ -95,14 +96,14 @@ void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) | |||
95 | stats->hiwater_vm = get_mm_hiwater_vm(mm) * PAGE_SIZE / KB; | 96 | stats->hiwater_vm = get_mm_hiwater_vm(mm) * PAGE_SIZE / KB; |
96 | mmput(mm); | 97 | mmput(mm); |
97 | } | 98 | } |
98 | stats->read_char = p->ioac.rchar; | 99 | stats->read_char = p->ioac.rchar & KB_MASK; |
99 | stats->write_char = p->ioac.wchar; | 100 | stats->write_char = p->ioac.wchar & KB_MASK; |
100 | stats->read_syscalls = p->ioac.syscr; | 101 | stats->read_syscalls = p->ioac.syscr & KB_MASK; |
101 | stats->write_syscalls = p->ioac.syscw; | 102 | stats->write_syscalls = p->ioac.syscw & KB_MASK; |
102 | #ifdef CONFIG_TASK_IO_ACCOUNTING | 103 | #ifdef CONFIG_TASK_IO_ACCOUNTING |
103 | stats->read_bytes = p->ioac.read_bytes; | 104 | stats->read_bytes = p->ioac.read_bytes & KB_MASK; |
104 | stats->write_bytes = p->ioac.write_bytes; | 105 | stats->write_bytes = p->ioac.write_bytes & KB_MASK; |
105 | stats->cancelled_write_bytes = p->ioac.cancelled_write_bytes; | 106 | stats->cancelled_write_bytes = p->ioac.cancelled_write_bytes & KB_MASK; |
106 | #else | 107 | #else |
107 | stats->read_bytes = 0; | 108 | stats->read_bytes = 0; |
108 | stats->write_bytes = 0; | 109 | stats->write_bytes = 0; |