[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdaCyiriM3xLJQ=OmcVRV6YY94mqsyaje1g2Fo_FMC1W6w@mail.gmail.com>
Date: Wed, 20 Dec 2017 10:32:51 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-gpio@...r.kernel.org
Subject: Re: [PATCH 1/4] gpio: sysfs: change 'value' attribute to prealloc
On Mon, Dec 18, 2017 at 11:08 AM, Christophe Leroy
<christophe.leroy@....fr> wrote:
> The GPIO 'value' attribute is time critical. A small bench with
> 'perf record' on the app below shows that 80% of the time spent in
> sysfs_kf_seq_show() is spent in memset() for zeroising the buffer.
>
> |--67.48%--sysfs_kf_seq_show
> | |
> | |--54.40%--memset
> | |
> | |--11.49%--dev_attr_show
> | | |
> | | |--10.06%--value_show
> | | | |
> | | | |--4.75%--sprintf
> | | | | |
>
> This patch changes the attribute type to prealloc, eliminating the
> need to zeroise the buffer at each read. 'perf record' gives the
> following result.
>
> |--42.41%--sysfs_kf_read
> | |
> | |--39.73%--dev_attr_show
> | | |
> | | |--38.23%--value_show
> | | | |
> | | | |--29.22%--sprintf
> | | | | |
>
> Test done with the following small app:
>
> int main(int argc, char **argv)
> {
> int fd = open(argv[1], O_RDONLY);
>
> for (;;) {
> int buf[512];
>
> read(fd, buf, 512);
> lseek(fd, 0, SEEK_SET);
> }
> exit(0);
> }
>
> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
I applied this because I don't want to waste honest development efforts.
Fixes and improvements I can accept. But not extensions.
But as Bartosz says it would be nice to focus efforts on the non-deprecated
ABI.
Yours,
Linus Walleij
Powered by blists - more mailing lists