* [PATCH 1/1 linux-next RESEND] task IO accounting: add conditional read/write counters
@ 2015-03-03 20:16 Fabian Frederick
2015-03-03 22:04 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2015-03-03 20:16 UTC (permalink / raw)
To: linux-kernel
Cc: Andrew Morton, Fabian Frederick, Jonathan Corbet, Ingo Molnar,
Peter Zijlstra, linux-doc
This patch adds syscre and syscwe respectively effective read/write
syscall counters. We already had syscr/syscw which were
unconditionally incremented. Doing the difference between those
variables could give interesting statistics.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
Documentation/filesystems/proc.txt | 16 ++++++++++++++++
fs/proc/base.c | 4 ++++
include/linux/sched.h | 2 ++
include/linux/task_io_accounting.h | 4 ++++
4 files changed, 26 insertions(+)
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 6d37062..34fb7ee 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1541,6 +1541,22 @@ I/O counter: write syscalls
Attempt to count the number of write I/O operations, i.e. syscalls like
write() and pwrite().
+syscre
+------
+
+I/O counter: Effective read syscalls
+Attempt to count the number of effective read I/O operations,
+i.e. syscalls like read() and pread().
+
+
+syscwe
+------
+
+I/O counter: Effective write syscalls
+Attempt to count the number of effective write I/O operations,
+i.e. syscalls like read() and pread().
+
+
read_bytes
----------
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7a3b82f..54a7c93 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2367,6 +2367,8 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
"wchar: %llu\n"
"syscr: %llu\n"
"syscw: %llu\n"
+ "syscre: %llu\n"
+ "syscwe: %llu\n"
"read_bytes: %llu\n"
"write_bytes: %llu\n"
"cancelled_write_bytes: %llu\n",
@@ -2374,6 +2376,8 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
(unsigned long long)acct.wchar,
(unsigned long long)acct.syscr,
(unsigned long long)acct.syscw,
+ (unsigned long long)acct.syscre,
+ (unsigned long long)acct.syscwe,
(unsigned long long)acct.read_bytes,
(unsigned long long)acct.write_bytes,
(unsigned long long)acct.cancelled_write_bytes);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6d77432..ec316ee 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3020,11 +3020,13 @@ extern int task_can_switch_user(struct user_struct *up,
#ifdef CONFIG_TASK_XACCT
static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
{
+ tsk->ioac.syscre++;
tsk->ioac.rchar += amt;
}
static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
{
+ tsk->ioac.syscwe++;
tsk->ioac.wchar += amt;
}
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index bdf855c..bc94291 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -18,6 +18,10 @@ struct task_io_accounting {
u64 syscr;
/* # of write syscalls */
u64 syscw;
+ /* # of effective read syscalls */
+ u64 syscre;
+ /* # of effective write syscalls */
+ u64 syscwe;
#endif /* CONFIG_TASK_XACCT */
#ifdef CONFIG_TASK_IO_ACCOUNTING
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1 linux-next RESEND] task IO accounting: add conditional read/write counters
2015-03-03 20:16 [PATCH 1/1 linux-next RESEND] task IO accounting: add conditional read/write counters Fabian Frederick
@ 2015-03-03 22:04 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-03-03 22:04 UTC (permalink / raw)
To: Fabian Frederick
Cc: linux-kernel, Jonathan Corbet, Ingo Molnar, Peter Zijlstra, linux-doc
On Tue, 3 Mar 2015 21:16:35 +0100 Fabian Frederick <fabf@skynet.be> wrote:
> This patch adds syscre and syscwe respectively effective read/write
> syscall counters. We already had syscr/syscw which were
> unconditionally incremented. Doing the difference between those
> variables could give interesting statistics.
I don't think that "could give interesting statistics" is sufficient
justification for adding overhead and extending the Linux userspace
interface.
More specificity would help, including real-worldish use cases which
demonstrate the value.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 20:16 [PATCH 1/1 linux-next RESEND] task IO accounting: add conditional read/write counters Fabian Frederick
2015-03-03 22:04 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).