All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Roland McGrath <roland@redhat.com>,
	jan.kratochvil@redhat.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org
Subject: Re: [RFC] Proposal for ptrace improvements
Date: Fri, 4 Mar 2011 18:05:08 +0100	[thread overview]
Message-ID: <AANLkTinn_J3fxyjgQk02mHpbxh_5fXNk1qT-YwjgCGqK@mail.gmail.com> (raw)
In-Reply-To: <20110304144059.GS20499@htj.dyndns.org>

On Fri, Mar 4, 2011 at 3:40 PM, Tejun Heo <tj@kernel.org> wrote:
> On Fri, Mar 04, 2011 at 03:31:15PM +0100, Denys Vlasenko wrote:
>> On Fri, Mar 4, 2011 at 3:07 PM, Tejun Heo <tj@kernel.org> wrote:
>> > Hello,
>> >
>> > On Fri, Mar 04, 2011 at 02:59:32PM +0100, Denys Vlasenko wrote:
>> >> I would rather speed strace up than slow it down further, even if
>> >> slightly.
>> >
>> > The question to ask is at what cost?  If mostly unnoticeable slow down
>> > makes the API cleaner, I'll go that way.  Everything is a tradeoff.
>>
>> # time sh -c 'ls -lR /usr/share >/dev/null'
>> real  0m2.633s
>>
>> strace without PTRACE_GETSIGINFO:
>> real  0m47.023s
>> real  0m48.799s
>> real  0m47.695s
>>
>> strace with PTRACE_GETSIGINFO:
>> real  0m51.958s
>> real  0m53.773s
>> real  0m51.625s
>
> Great, numbers, so it's ~10 slow down.  Gees, with or without that
> change, strace(2) is heavy, >18 times slower than without.

Here's a typical sequence of operations strace is doing:

wait4(-1, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGTRAP}], __WALL, NULL) = 10445
ptrace(PTRACE_GETSIGINFO, 10445, 0, {si_signo=SIGTRAP, si_code=0x5,
si_pid=10445, si_uid=0, si_value={int=0, ptr=0}}) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*ORIG_RAX, [0x36]) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*CS, [0x23]) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*RAX, [0xffffffffffffffda]) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*RBX, [0x1]) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*RCX, [0x5401]) = 0
ptrace(PTRACE_PEEKUSER, 10445, 8*RDX, [0xffb83f10]) = 0
ptrace(PTRACE_SYSCALL, 10445, 0x1, SIG_0) = 0

IOW: strace wastes a lot of time just transiting to the kernel and back
with simple syscalls to get the information.

What would help here is a "vectorized" waitpid operation
which retrieves much more information in one go:

waitpid_vec(int max_results, int status_vector[], siginfo_t
si_vector[], struct pt_regs reg_vector[])

-- 
vda

  reply	other threads:[~2011-03-04 17:06 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 15:24 [RFC] Proposal for ptrace improvements Tejun Heo
2011-03-01 16:57 ` Denys Vlasenko
2011-03-01 17:09   ` Tejun Heo
2011-03-01 17:12     ` Tejun Heo
2011-03-01 17:21     ` Denys Vlasenko
2011-03-01 18:34       ` Tejun Heo
2011-03-01 23:51         ` Denys Vlasenko
2011-03-02  7:10           ` Tejun Heo
2011-03-02  5:07         ` Indan Zupancic
2011-03-02  7:44           ` Tejun Heo
2011-03-02 11:32             ` Indan Zupancic
2011-03-02 11:52               ` Denys Vlasenko
2011-03-02 14:50               ` Tejun Heo
2011-03-02 13:32             ` Oleg Nesterov
2011-03-03  0:47               ` Indan Zupancic
2011-03-03  1:30                 ` Denys Vlasenko
2011-03-03  1:55                   ` Indan Zupancic
2011-03-03  7:03                     ` Tejun Heo
2011-03-01 19:06 ` Jan Kratochvil
2011-03-01 22:14   ` Denys Vlasenko
2011-03-02  7:28     ` Tejun Heo
2011-03-02 10:58       ` Denys Vlasenko
2011-03-04 16:14     ` Jan Kratochvil
2011-03-04 16:41       ` Denys Vlasenko
2011-03-04 17:07       ` Oleg Nesterov
2011-03-04 18:12         ` Jan Kratochvil
2011-03-05  8:47           ` Tejun Heo
2011-03-01 22:59 ` Denys Vlasenko
2011-03-02  7:32   ` Tejun Heo
2011-03-02 11:02     ` Denys Vlasenko
2011-03-02 11:23       ` Tejun Heo
2011-03-03 19:26         ` Oleg Nesterov
2011-03-01 23:16 ` Denys Vlasenko
2011-03-02  7:37   ` Tejun Heo
2011-03-02 11:21     ` Denys Vlasenko
2011-03-02 11:27       ` Tejun Heo
2011-03-02 11:48         ` Denys Vlasenko
2011-03-02 14:43           ` Tejun Heo
2011-03-02 15:16             ` Denys Vlasenko
2011-03-02 15:25               ` Tejun Heo
2011-03-03 17:34 ` Oleg Nesterov
2011-03-03 20:22   ` Oleg Nesterov
2011-03-04  8:23     ` Tejun Heo
2011-03-04 18:16       ` Oleg Nesterov
2011-03-05  8:33         ` Tejun Heo
2011-03-04 13:01     ` Denys Vlasenko
2011-03-04 13:41       ` Tejun Heo
2011-03-04 13:59         ` Denys Vlasenko
2011-03-04 14:07           ` Tejun Heo
2011-03-04 14:31             ` Denys Vlasenko
2011-03-04 14:40               ` Tejun Heo
2011-03-04 17:05                 ` Denys Vlasenko [this message]
2011-03-04 17:12                   ` Linus Torvalds
2011-03-04 18:59                     ` Denys Vlasenko
2011-03-04 19:24                       ` Linus Torvalds
2011-03-04 16:13               ` Oleg Nesterov
2011-03-04 16:30                 ` Oleg Nesterov
2011-03-04  8:44   ` Tejun Heo
2011-03-04 16:01     ` Oleg Nesterov
2011-03-04 16:15       ` Tejun Heo
2011-03-04 16:26         ` Oleg Nesterov
2011-03-07 15:08 ` PTRACE_SEIZE/INTERRUPT: " Oleg Nesterov
2011-03-09  9:41   ` Tejun Heo
2011-03-09 17:30     ` Oleg Nesterov
2011-03-07 20:43 ` Roland McGrath
2011-03-09 10:28   ` Tejun Heo
2011-03-10 18:33     ` Steven Rostedt
2011-03-11  8:13       ` Tejun Heo
2011-03-11  8:22       ` Ingo Molnar
2011-03-11  9:35         ` Srikar Dronamraju
2011-03-11  9:43           ` Ingo Molnar
2011-03-14  1:03     ` Frank Ch. Eigler
2011-03-10 15:55   ` Steven Rostedt

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=AANLkTinn_J3fxyjgQk02mHpbxh_5fXNk1qT-YwjgCGqK@mail.gmail.com \
    --to=vda.linux@googlemail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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.