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: <20160807084249.GA1871@p183.telecom.by>
Date:	Sun, 7 Aug 2016 11:42:50 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] proc: much faster /proc/vmstat

On Sun, Aug 07, 2016 at 02:35:13AM +0100, Al Viro wrote:
> On Sat, Aug 06, 2016 at 03:54:56PM +0300, Alexey Dobriyan wrote:
> 
> [sprintf sucks, let's convert numbers manually]
> 
> > --- a/mm/vmstat.c
> > +++ b/mm/vmstat.c
> > @@ -1592,7 +1592,10 @@ static int vmstat_show(struct seq_file *m, void *arg)
> >  {
> >  	unsigned long *l = arg;
> >  	unsigned long off = l - (unsigned long *)m->private;
> > -	seq_printf(m, "%s %lu\n", vmstat_text[off], *l);
> > +
> > +	seq_puts(m, vmstat_text[off]);
> > +	seq_put_decimal_ull(m, ' ', *l);
> > +	seq_putc(m, '\n');
> >  	return 0;
> >  }
> 
> If that manages to be a hotspot, we really should
> 	* educate the wankers responsible for the userland code in question,
> until they repent and cease committing such abominations.

I'll get right on that.

> 	* look into fixing vsnprintf().  
> 
> Seriously, what the hell is vsnprintf() doing that takes so much time?  It's
> not as if it was a complex format anyway.  WTF is going on there?  Where is
> it spending that much time?

1. format_decode() is busy looking for format specifier: 2 branches per character
   (not in this case, but in others)

2. approximately million branches while parsing format mini language
   and everywhere

3. just look at what string() does
   /proc/vmstat is good case because most of its content are strings

But the patch will still be faster.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ