public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: renzo@cs.unibo.it (Renzo Davoli)
To: Andi Kleen <ak@suse.de>
Cc: osd@cs.unibo.it, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2-ptrace_multi
Date: Thu, 18 May 2006 23:13:21 +0200	[thread overview]
Message-ID: <20060518211321.GC6806@cs.unibo.it> (raw)
In-Reply-To: <p73sln72im3.fsf@bragg.suse.de>

On Thu, May 18, 2006 at 10:17:08PM +0200, Andi Kleen wrote:
> > With PTRACE_MULTI option you can send multiple ptrace requests with a 
> > single system call: commonly a process that uses ptrace() needs
> > several PTRACE_PEEKDATA for getting some useful, even small pieces of data.
> > It is useful for these programs to run several ptrace
> > operations while limiting the number of context switches.
> 
> What context switches do you mean?  System calls? Linux is in general
> designed to have very cheap system calls and they shouldn't be more tha
> a few hundred cycles. 
Agree, but they are a few hundred cycles wasted.
This can be highly significative when you are working on a Virtual Machine
monitor.
In umview the monitor (umview process) and the process inside the VM
live in separate address spaces.
e.g. To virtualize a write you'd have to call PTRACE_PEEKDATA for each 
word of the buffer, very many hundreds cycles lost.
> > 
> > Debuggers and virtual machines (like User Mode Linux) and many other 
> > applications that are based on ptrace can get great 
> > performance improvements by PTRACE_MULTI: the number of system
> > calls (and context switches) decreases significantly.
> 
> You forgot to add numbers? 
They are obviously highly dependant on applications.

(test computer=tibook G4 1Ghz)
Umview+unreal test module/NO PTRACE_MULTI/NO PTRACE_SYSVM
$ time cp /unreal/usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m22.626s
user    0m0.000s
sys     0m0.448s

Umview+unreal test module/NO_SYSVM  WITH PTRACE_MULTI
$ time cp /unreal/usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m1.850s
user    0m0.008s
sys     0m0.384s

Umview+unreal test module/SYSVM+MULTI
$ time cp /unreal/usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m1.261s
user    0m0.012s
sys     0m0.392s

This is a test on the cost of umview virtualization with no modules.
Umview alone/NO SYSVM/NO PTRACE_MULTI
$ time cp /usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m1.595s
user    0m0.000s
sys     0m0.548s

Umview alone/NO SYSVM (with ptrace_multi)
$ time cp /usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m1.587s
user    0m0.008s
sys     0m0.596s

Umview alone/With SYSVM (and ptrace_multi)
$ time cp /usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m1.056s
user    0m0.008s
sys     0m0.496s

The same command on the Linux kernel (NO umview)
$ time cp /usr/src/linux-source-2.6.16.tar.bz2 /tmp
real    0m0.429s 
user    0m0.004s
sys     0m0.368s

This is a worst case run of umview as cp is absolutely IO bound (and
system call bound). The more computation a program has the more
efficient is the VM. The user mode VM costs in this case 2.5 times slowdown.

renzo

  reply	other threads:[~2006-05-18 21:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 15:53 ptrace enhancements for VM support (patch proposals follow in sep.msgs) Renzo Davoli
2006-05-18 15:56 ` [PATCH] 1-access_process_vm_user Renzo Davoli
2006-05-18 15:58 ` [PATCH] 2-ptrace_multi Renzo Davoli
2006-05-18 20:17   ` Andi Kleen
2006-05-18 21:13     ` Renzo Davoli [this message]
2006-05-19  2:23       ` Ulrich Drepper
2006-05-19  9:07         ` Renzo Davoli
2006-05-19 13:09           ` Daniel Jacobowitz
2006-05-19 17:45             ` Renzo Davoli
2006-05-19 19:15               ` Renzo Davoli
2006-05-19 20:15               ` Daniel Jacobowitz
2006-05-19 20:17                 ` Andi Kleen
2006-05-20  6:44                   ` Ulrich Drepper
2006-05-20 14:37                   ` Alan Cox
2006-05-20 18:30                     ` Renzo Davoli
2006-05-20 20:23                       ` Ulrich Drepper
2006-05-20 21:39                       ` Jeff Dike
2006-05-21 12:38                         ` Avi Kivity
2006-05-21 15:28                         ` Renzo Davoli
2006-05-22 13:02                           ` Daniel Jacobowitz
2006-05-22 15:05                             ` Renzo Davoli
2006-05-22 15:26                               ` Daniel Jacobowitz
2006-05-18 16:07 ` [PATCH] 3-ptrace_vm Renzo Davoli
2006-05-21  8:03 ` ptrace enhancements for VM support (patch proposals follow in sep.msgs) Peter Chubb

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=20060518211321.GC6806@cs.unibo.it \
    --to=renzo@cs.unibo.it \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osd@cs.unibo.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox