From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk
Subject: Re: [PATCH] proc: faster /proc/*/status
Date: Sun, 7 Aug 2016 11:53:22 +0300 [thread overview]
Message-ID: <20160807085322.GB1871@p183.telecom.by> (raw)
In-Reply-To: <87ziop46b8.fsf@tassilo.jf.intel.com>
On Sat, Aug 06, 2016 at 08:16:27PM -0700, Andi Kleen wrote:
> Alexey Dobriyan <adobriyan@gmail.com> writes:
> > -
> > + seq_printf(m, "State:\t%s", get_task_state(p));
> > +
> > + seq_puts(m, "\nTgid:\t");
>
> The only different should be the format string.
>
> Scanning the format string really shouldn't be that expensive?!?
Surprise, it is (see my reply to Al).
What seq_put_decimal_ull() did is the equivalent of
seq << "foo";
seq << bar;
seq << '\n';
No precisions, not widths, no padding, no upper and lowercasing.
> It would be better if you could find out why that is slow and optimize
> it. Then you would benefit every seq_printf user, not just this
> special case.
>
> Perhaps it could benefit from some of the bit masking tricks to
> scan the string with wider tests than a word.
And then what? Parsing format string is still be there.
This is first line of profile of the first function (format_decode)
│ static noinline_for_stack
│ int format_decode(const char *fmt, struct printf_spec *spec)
│ {
10.38 │ push %rbp <===
1.07 │ mov %rsp,%rbp
1.09 │ push %r12
4.51 │ mov %rsi,%r12
1.40 │ push %rbx
1.86 │ mov %rdi,%rbx
│ sub $0x8,%rsp
It is so bloated that gcc needs to be asked to not screw up with stack
size.
next prev parent reply other threads:[~2016-08-07 8:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-06 12:56 [PATCH] proc: faster /proc/*/status Alexey Dobriyan
2016-08-06 22:41 ` Joe Perches
2016-08-09 3:02 ` [PATCH] seq/proc: Modify seq_put_decimal_[u]ll to take a const char *, not char Joe Perches
2016-08-07 3:16 ` [PATCH] proc: faster /proc/*/status Andi Kleen
2016-08-07 8:53 ` Alexey Dobriyan [this message]
2016-08-07 16:59 ` Andi Kleen
2016-08-07 17:39 ` Joe Perches
2016-08-07 17:44 ` Andi Kleen
2016-08-07 21:22 ` Joe Perches
2016-08-09 23:25 ` Andrew Morton
2016-08-10 6:38 ` [RFC PATCH] meminfo: Break apart a very long seq_printf with #ifdefs Joe Perches
2016-08-11 21:50 ` Andrew Morton
2016-08-11 21:57 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160807085322.GB1871@p183.telecom.by \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.