sysfs_kf_seq_show() spends 87% of time in memset()
From: Christophe LEROY
Date: Fri Dec 15 2017 - 08:00:05 EST
Hello Tejun,
Doing a 'perf record' on an application using GPIOs a lot, I discovered
that most of the time spent in the read() system call of the 'value'
sysfs file of that GPIO (which returns "0\n" or "1\n") is indeed spent
in memset() zeroing a buffer of size PAGE_SIZE for a 2 bytes read:
--1.95%--ret_from_syscall
sys_read
|
--1.93%--vfs_read
|
--1.89%--__vfs_read
|
--1.86%--seq_read
|
--1.68%--sysfs_kf_seq_show
|
--1.46%--memset
As far as I can see, that memset() was introduced by your commit
f5c16f29bf5e5 ("sysfs: make sure read buffer is zeroed")
Is that really necessary, taking into account that the ->show will
overwrite it ?
Thanks
Christophe