Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106321
b: refs/heads/master
c: b2d002d
h: refs/heads/master
i:
  106319: 3bb6b2d
v: v3
  • Loading branch information
Andrea Righi authored and Linus Torvalds committed Jul 27, 2008
1 parent 878ef7c commit 4694452
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a9436d0c3cbe8941b1acd5b0736d355295cad98
refs/heads/master: b2d002dba5a8a4c0c3ec96fd1ff3c9def6bd71a1
56 changes: 22 additions & 34 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2406,35 +2406,18 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
u64 rchar, wchar, syscr, syscw;
struct task_io_accounting ioac;

if (!whole) {
rchar = task->rchar;
wchar = task->wchar;
syscr = task->syscr;
syscw = task->syscw;
memcpy(&ioac, &task->ioac, sizeof(ioac));
} else {
unsigned long flags;
struct task_struct *t = task;
rchar = wchar = syscr = syscw = 0;
memset(&ioac, 0, sizeof(ioac));
rchar = task->rchar;
wchar = task->wchar;
syscr = task->syscr;
syscw = task->syscw;
memcpy(&ioac, &task->ioac, sizeof(ioac));

rcu_read_lock();
do {
rchar += t->rchar;
wchar += t->wchar;
syscr += t->syscr;
syscw += t->syscw;

ioac.read_bytes += t->ioac.read_bytes;
ioac.write_bytes += t->ioac.write_bytes;
ioac.cancelled_write_bytes +=
t->ioac.cancelled_write_bytes;
t = next_thread(t);
} while (t != task);
rcu_read_unlock();
if (whole) {
unsigned long flags;

if (lock_task_sighand(task, &flags)) {
struct signal_struct *sig = task->signal;
struct task_struct *t = task;

rchar += sig->rchar;
wchar += sig->wchar;
Expand All @@ -2445,11 +2428,20 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
ioac.write_bytes += sig->ioac.write_bytes;
ioac.cancelled_write_bytes +=
sig->ioac.cancelled_write_bytes;

while_each_thread(task, t) {
rchar += t->rchar;
wchar += t->wchar;
syscr += t->syscr;
syscw += t->syscw;

ioac.read_bytes += t->ioac.read_bytes;
ioac.write_bytes += t->ioac.write_bytes;
ioac.cancelled_write_bytes +=
t->ioac.cancelled_write_bytes;
}
unlock_task_sighand(task, &flags);
}
}

return sprintf(buffer,
"rchar: %llu\n"
"wchar: %llu\n"
Expand All @@ -2458,13 +2450,9 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
"read_bytes: %llu\n"
"write_bytes: %llu\n"
"cancelled_write_bytes: %llu\n",
(unsigned long long)rchar,
(unsigned long long)wchar,
(unsigned long long)syscr,
(unsigned long long)syscw,
(unsigned long long)ioac.read_bytes,
(unsigned long long)ioac.write_bytes,
(unsigned long long)ioac.cancelled_write_bytes);
rchar, wchar, syscr, syscw,
ioac.read_bytes, ioac.write_bytes,
ioac.cancelled_write_bytes);
}

static int proc_tid_io_accounting(struct task_struct *task, char *buffer)
Expand Down

0 comments on commit 4694452

Please sign in to comment.