diff options
author | Andrea Righi <righi.andrea@gmail.com> | 2008-07-27 11:29:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-27 12:58:20 -0400 |
commit | 5995477ab7f3522c497c9c4a1c55373e9d655574 (patch) | |
tree | a147fb61642a7ac5441855964eb97a2ff1e37202 /kernel/fork.c | |
parent | 605ccb73f6a1c891a16268b3a2923208fc637958 (diff) |
task IO accounting: improve code readability
Put all i/o statistics in struct proc_io_accounting and use inline functions to
initialize and increment statistics, removing a lot of single variable
assignments.
This also reduces the kernel size as following (with CONFIG_TASK_XACCT=y and
CONFIG_TASK_IO_ACCOUNTING=y).
text data bss dec hex filename
11651 0 0 11651 2d83 kernel/exit.o.before
11619 0 0 11619 2d63 kernel/exit.o.after
10886 132 136 11154 2b92 kernel/fork.o.before
10758 132 136 11026 2b12 kernel/fork.o.after
3082029 807968 4818600 8708597 84e1f5 vmlinux.o.before
3081869 807968 4818600 8708437 84e155 vmlinux.o.after
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Acked-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 5e050c1317c4..8214ba7c8bb1 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -806,12 +806,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
806 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; | 806 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; |
807 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; | 807 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; |
808 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; | 808 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; |
809 | #ifdef CONFIG_TASK_XACCT | 809 | task_io_accounting_init(&sig->ioac); |
810 | sig->rchar = sig->wchar = sig->syscr = sig->syscw = 0; | ||
811 | #endif | ||
812 | #ifdef CONFIG_TASK_IO_ACCOUNTING | ||
813 | memset(&sig->ioac, 0, sizeof(sig->ioac)); | ||
814 | #endif | ||
815 | sig->sum_sched_runtime = 0; | 810 | sig->sum_sched_runtime = 0; |
816 | INIT_LIST_HEAD(&sig->cpu_timers[0]); | 811 | INIT_LIST_HEAD(&sig->cpu_timers[0]); |
817 | INIT_LIST_HEAD(&sig->cpu_timers[1]); | 812 | INIT_LIST_HEAD(&sig->cpu_timers[1]); |
@@ -994,13 +989,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
994 | p->last_switch_timestamp = 0; | 989 | p->last_switch_timestamp = 0; |
995 | #endif | 990 | #endif |
996 | 991 | ||
997 | #ifdef CONFIG_TASK_XACCT | 992 | task_io_accounting_init(&p->ioac); |
998 | p->rchar = 0; /* I/O counter: bytes read */ | ||
999 | p->wchar = 0; /* I/O counter: bytes written */ | ||
1000 | p->syscr = 0; /* I/O counter: read syscalls */ | ||
1001 | p->syscw = 0; /* I/O counter: write syscalls */ | ||
1002 | #endif | ||
1003 | task_io_accounting_init(p); | ||
1004 | acct_clear_integrals(p); | 993 | acct_clear_integrals(p); |
1005 | 994 | ||
1006 | p->it_virt_expires = cputime_zero; | 995 | p->it_virt_expires = cputime_zero; |