Skip to content

Commit 2320222

Browse files
oleg-nesterovakpm00
authored andcommitted
do_io_accounting: use __for_each_thread()
Rather than while_each_thread() which should be avoided when possible. This makes the code more clear and allows the next change. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Oleg Nesterov <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 873ed72 commit 2320222

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/proc/base.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,7 +2972,7 @@ static const struct file_operations proc_coredump_filter_operations = {
29722972
#ifdef CONFIG_TASK_IO_ACCOUNTING
29732973
static int do_io_accounting(struct task_struct *task, struct seq_file *m, int whole)
29742974
{
2975-
struct task_io_accounting acct = task->ioac;
2975+
struct task_io_accounting acct;
29762976
unsigned long flags;
29772977
int result;
29782978

@@ -2986,14 +2986,18 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
29862986
}
29872987

29882988
if (whole && lock_task_sighand(task, &flags)) {
2989-
struct task_struct *t = task;
2989+
struct signal_struct *sig = task->signal;
2990+
struct task_struct *t;
29902991

2991-
task_io_accounting_add(&acct, &task->signal->ioac);
2992-
while_each_thread(task, t)
2992+
acct = sig->ioac;
2993+
__for_each_thread(sig, t)
29932994
task_io_accounting_add(&acct, &t->ioac);
29942995

29952996
unlock_task_sighand(task, &flags);
2997+
} else {
2998+
acct = task->ioac;
29962999
}
3000+
29973001
seq_printf(m,
29983002
"rchar: %llu\n"
29993003
"wchar: %llu\n"

0 commit comments

Comments
 (0)