[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <66a5a5e1adf944f592202e5ffdf3fe9c@AcuMS.aculab.com>
Date: Fri, 30 Aug 2019 13:21:16 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'Enrico Weigelt, metux IT consult'" <lkml@...ux.net>,
Uwe Kleine-König <uwe@...ine-koenig.org>,
Andrew Morton <akpm@...ux-foundation.org>
CC: Jonathan Corbet <corbet@....net>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: RE: [PATCH v1 1/2] vsprintf: introduce %dE for error constants
From: Enrico Weigelt, metux IT consult
> Sent: 26 August 2019 14:29
> On 25.08.19 01:37, Uwe Kleine-König wrote:
>
> Hi,
>
> > +static noinline_for_stack > +char *errstr(char *buf, char *end, unsigned long long num,> +
> struct printf_spec spec)> +{
> #1: why not putting that into some separate strerror() lib function ?
> This is something I've been looking for quite some time (actually
> already hacked it up somewhere, sometime, but forgotten ...)
>
> #2: why not just having a big case statement and leave the actual lookup
> logic to the compiler ? IMHO, could be written in a very compact way
> by some macro magic
And generate an enormous amount of code and long chains of mispredicted branches.
Is it also worth looking at how long the strings are.
If they can be truncated to 16 bytes then char[][16] will generate
much better code than the array of pointers.
OTOH I'm not really sure it is all a good idea.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists