#include <linux/kernel_stat.h>
#include <linux/fdtable.h>
#include <linux/math64.h>
+#include <linux/task_io_accounting_ops.h>
#define DEBUG 0
#define PAGE_TO_KB(x) ((x) << (PAGE_SHIFT - 10))
static int stability_monitor_show(struct seq_file *m, void *v)
{
struct sysinfo info;
- struct task_struct *task;
+ struct task_struct *task, *t;
struct pid *pid = NULL;
pid_t ppid = 0;
+ u64 uptime;
cputime_t utime, stime;
- unsigned long long vm_rss, total_ram, task_io;
+ unsigned long long vm_rss, total_ram;
+ struct task_io_accounting task_ioac;
unsigned int open_fds;
- u64 uptime;
rcu_read_lock();
thread_group_cputime_adjusted(task, &utime, &stime);
/* IO */
- task_io = (unsigned long long)task->ioac.read_bytes + (unsigned long long)task->ioac.write_bytes;
+ task_ioac = task->ioac;
+ t = task;
+ while_each_thread(task, t)
+ task_io_accounting_add(&task_ioac, &t->ioac);
+
task_unlock(task);
seq_put_decimal_ull(m, ' ', cputime_to_usecs(utime + stime));
seq_put_decimal_ull(m, ' ', PAGE_TO_KB(vm_rss)); // kB
seq_put_decimal_ll(m, ' ', open_fds);
- seq_put_decimal_ull(m, ' ', task_io);
+ seq_put_decimal_ull(m, ' ', task_ioac.read_bytes + task_ioac.write_bytes);
seq_printf(m, "\n");
}