lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Dec 2017 13:59:55 +0100
From:   Christophe LEROY <christophe.leroy@....fr>
To:     Alexander Viro <viro@...iv.linux.org.uk>, Tejun Heo <tj@...nel.org>
Cc:     linux-fsdevel@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: sysfs_kf_seq_show() spends 87% of time in memset()

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ