lkml.org 
[lkml]   [2018]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 13/13] proc: convert /proc/*/task/*/children to _print_integer()
Date
Benchmark pread /proc/1/task/1/children 2^21 times on the same system:

6.766400479 s
4.328648442

-36%

(need to remeasure on a controlled set of children)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/proc/array.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index d0565527166a..045ce2cac1dd 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -710,9 +710,11 @@ get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos)
static int children_seq_show(struct seq_file *seq, void *v)
{
struct inode *inode = file_inode(seq->file);
+ char buf[10 + 1], *p = buf + sizeof(buf);

- seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode)));
- return 0;
+ *--p = ' ';
+ p = _print_integer_u32(p, pid_nr_ns(v, proc_pid_ns(inode)));
+ return seq_write(seq, p, buf + sizeof(buf) - p);
}

static void *children_seq_start(struct seq_file *seq, loff_t *pos)
--
2.16.4
\
 
 \ /
  Last update: 2018-08-28 01:16    [W:0.384 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site