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-prev] [day] [month] [year] [list]
Message-ID: <CANaxB-wBft5yPi1QQOkU6Q28S+urS2+dZk+h2mPALx9-iM4Sjw@mail.gmail.com>
Date:   Wed, 9 Nov 2016 13:40:47 -0800
From:   Andrei Vagin <avagin@...il.com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fs/proc/array.c: slightly improve render_sigset_t

On Tue, Sep 20, 2016 at 3:28 PM, Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
> format_decode and vsnprintf occasionally show up in perf top, so I
> went looking for places that might not need the full printf
> power. With the help of kprobes, I gathered some statistics on which
> format strings we mostly pass to vsnprintf. On a trivial desktop
> workload, I hit "%x" 25% of the time, so something apparently reads
> /proc/pid/status (which does 5*16 printf("%x") calls) a lot.
>
> With this patch, reading /proc/pid/status is 30% faster according to
> this microbenchmark:
>
>         char buf[4096];
>         int i, fd;
>         for (i = 0; i < 10000; ++i) {
>                 fd = open("/proc/self/status", O_RDONLY);
>                 read(fd, buf, sizeof(buf));
>                 close(fd);
>         }
>

Acked-by: Andrei Vagin <avagin@...nvz.org>

Andrew, could you replace my patch
"proc-optimize-render_sigset_t.patch" to this one.

Thanks,
Andrei

> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
>  fs/proc/array.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index 88c7de12197b..7f73b689a15c 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -251,7 +251,7 @@ void render_sigset_t(struct seq_file *m, const char *header,
>                 if (sigismember(set, i+2)) x |= 2;
>                 if (sigismember(set, i+3)) x |= 4;
>                 if (sigismember(set, i+4)) x |= 8;
> -               seq_printf(m, "%x", x);
> +               seq_putc(m, hex_asc[x]);
>         } while (i >= 4);
>
>         seq_putc(m, '\n');
> --
> 2.1.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ