All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@karaya.com>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: uml-patch-2.5.49-1
Date: Tue, 26 Nov 2002 13:29:21 -0500	[thread overview]
Message-ID: <200211261829.NAA02265@ccure.karaya.com> (raw)
In-Reply-To: Your message of "26 Nov 2002 06:57:39 +0100." <p73u1i4ub3g.fsf@oldwotan.suse.de>

ak@suse.de said:
> Can you quickly describe why you didn't use one host process per uml
> process ?  
> That would have avoided the need for a /proc/mm extension too I guess.

Yes, it would have.  And it was done that way during an intermediate stage
of the skas work.

There were a few reasons for /proc/mm -
	reduce host resource consumption - we still have the mm_struct and
page tables, but we do eliminate the kernel stack, task struct, and associated
data
	design cleanliness - a UP UML is inherently single-threaded, so it's
pointless to have many host processes when only one of them can be running.
A host process maps much more cleanly onto a UML processor than a UML process,
and a UML process maps much more cleanly onto a host address space than a
host process.
	code cleanliness - before /proc/mm, UML manipulated address spaces
through ptrace (PTRACE_M{MAP,UNMAP,PROTECT}).  This meant that a process needed
to be used as a handle for the address space.  Since there's no way of knowing
what process in an address space is still going to exist when you want to swap
it out, the UML mm_context was a list of task_structs.  This made for some
nasty-looking code to keep that list up-to-date.  It also made for some 
nasty-looking locking against races between swapout and a thread exiting.  Now,
the UML mm_context is an int which holds a /proc/mm file descriptor.  No lists,
no races, it doesn't get any simpler.

Some smaller reasons -
	With the address space manipulations in /proc/mm rather than ptrace,
it is possible that a cleaner interface can be found for it.  The current
/proc/mm write semantics are morally equivalent to the previous ptrace 
interface, but there is hope that something better can be found.  With ptrace,
there is no hope.

	scheduling fairness - when you have a single-threaded app (in the sense
that there is only one active thread at any given time) that's spreading its
work over many threads, the thread that wants to run will compete unfairly
in the scheduler with another single-threaded app that is honestly doing all
of its work in one thread.  The thread in the first app will have accumulated
much less time than the second app's thread, and so will have higher priority,
even though the two apps may have used the same amount of CPU.  With /proc/mm,
UML gets much closer to one host process per processor, but doesn't quite
make it.  There are two host processes, one running the kernel, one running
userspace.  I'm trying to think of a way of merging them.

	It's much nicer to look at ps or top on the host and see a few 
(currently four) processes per UML rather than, say, 100.

An unexpected benefit - UML is noticably faster with /proc/mm.  That knocked
~10% off its kernel build time.  With it doing a build about 40% slower than
the host, the 10% reduction in overall run time represents ~25% reduction in
UML's virtualization overhead.

				Jeff


  parent reply	other threads:[~2002-11-26 18:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200211260517.AAA05038@ccure.karaya.com.suse.lists.linux.kernel>
2002-11-26  5:57 ` uml-patch-2.5.49-1 Andi Kleen
2002-11-26  6:07   ` uml-patch-2.5.49-1 Patrick Finnegan
2002-11-26  6:10     ` uml-patch-2.5.49-1 Andi Kleen
2002-11-26  7:02       ` uml-patch-2.5.49-1 Patrick Finnegan
2002-11-26 16:45         ` uml-patch-2.5.49-1 Rik van Riel
2002-11-26 18:29   ` Jeff Dike [this message]
2002-11-26 19:37     ` uml-patch-2.5.49-1 Andreas Dilger
2002-11-26 21:07       ` uml-patch-2.5.49-1 Jeff Dike
     [not found] <20021126061021.GA17959@wotan.suse.de.suse.lists.linux.kernel>
     [not found] ` <Pine.LNX.4.44.0211260159440.7540-100000@ibm-ps850.purdueriots.com.suse.lists.linux.kernel>
2002-11-26  7:08   ` uml-patch-2.5.49-1 Andi Kleen
2002-11-26  5:17 uml-patch-2.5.49-1 Jeff Dike
2002-11-26 14:14 ` uml-patch-2.5.49-1 jlnance
2002-11-26 18:33   ` uml-patch-2.5.49-1 Jeff Dike
2002-11-27  2:29     ` uml-patch-2.5.49-1 H. Peter Anvin
2002-11-27  4:06       ` uml-patch-2.5.49-1 Jeff Dike
2002-11-27  4:30         ` uml-patch-2.5.49-1 H. Peter Anvin
2002-11-27  5:08           ` uml-patch-2.5.49-1 Jeff Dike

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=200211261829.NAA02265@ccure.karaya.com \
    --to=jdike@karaya.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.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.