summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorAndrea Righi <righi.andrea@gmail.com>2008-07-27 17:29:15 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-27 09:58:20 -0700
commit5995477ab7f3522c497c9c4a1c55373e9d655574 (patch)
treea147fb61642a7ac5441855964eb97a2ff1e37202 /kernel/exit.c
parent605ccb73f6a1c891a16268b3a2923208fc637958 (diff)
downloadop-kernel-dev-5995477ab7f3522c497c9c4a1c55373e9d655574.zip
op-kernel-dev-5995477ab7f3522c497c9c4a1c55373e9d655574.tar.gz
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/exit.c')
-rw-r--r--kernel/exit.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 0caf590..eb4d647 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -121,18 +121,7 @@ static void __exit_signal(struct task_struct *tsk)
sig->nivcsw += tsk->nivcsw;
sig->inblock += task_io_get_inblock(tsk);
sig->oublock += task_io_get_oublock(tsk);
-#ifdef CONFIG_TASK_XACCT
- sig->rchar += tsk->rchar;
- sig->wchar += tsk->wchar;
- sig->syscr += tsk->syscr;
- sig->syscw += tsk->syscw;
-#endif /* CONFIG_TASK_XACCT */
-#ifdef CONFIG_TASK_IO_ACCOUNTING
- sig->ioac.read_bytes += tsk->ioac.read_bytes;
- sig->ioac.write_bytes += tsk->ioac.write_bytes;
- sig->ioac.cancelled_write_bytes +=
- tsk->ioac.cancelled_write_bytes;
-#endif /* CONFIG_TASK_IO_ACCOUNTING */
+ task_io_accounting_add(&sig->ioac, &tsk->ioac);
sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
sig = NULL; /* Marker for below. */
}
@@ -1363,21 +1352,8 @@ static int wait_task_zombie(struct task_struct *p, int options,
psig->coublock +=
task_io_get_oublock(p) +
sig->oublock + sig->coublock;
-#ifdef CONFIG_TASK_XACCT
- psig->rchar += p->rchar + sig->rchar;
- psig->wchar += p->wchar + sig->wchar;
- psig->syscr += p->syscr + sig->syscr;
- psig->syscw += p->syscw + sig->syscw;
-#endif /* CONFIG_TASK_XACCT */
-#ifdef CONFIG_TASK_IO_ACCOUNTING
- psig->ioac.read_bytes +=
- p->ioac.read_bytes + sig->ioac.read_bytes;
- psig->ioac.write_bytes +=
- p->ioac.write_bytes + sig->ioac.write_bytes;
- psig->ioac.cancelled_write_bytes +=
- p->ioac.cancelled_write_bytes +
- sig->ioac.cancelled_write_bytes;
-#endif /* CONFIG_TASK_IO_ACCOUNTING */
+ task_io_accounting_add(&psig->ioac, &p->ioac);
+ task_io_accounting_add(&psig->ioac, &sig->ioac);
spin_unlock_irq(&p->parent->sighand->siglock);
}
OpenPOWER on IntegriCloud