Hi, On Tue, Dec 6, 2011 at 7:48 PM, Riccardo Murri <riccardo.mu...@gmail.com> wrote: > > If I got it right: > > - The UML kernel runs in its own process (hence kernel space > separation, enforced by the host kernel), which is the parent of > all the UML processes (one per guest process).
The separation is enforced by memory mappings and mprotect(). A strict separation via processes would make UML very slow. (Yes, even more slower :P) > - The UML kernel process ptrace()'s its child processes. (just like > in TT mode, right?) Yep. UML is a system call emulator. Thus, to the guest processes UML looks like a real kernel... > - Two extra memory pages are allocated per child process, which > are to communicate with the kernel process during syscalls. Yes. This is where the black magic happens. UML installs hooks into the guest processes such that they cannot remove or modify memory mappings. > Since these pages need to be shared among two host processes (the > UML kernel and its child), they are allocated through mmap() > backed by a temporary file. > > Actually, I guess that the whole UML memory is allocated as mmap()'ed > pages from a temporary file: the UML kernel creates a file the size of the > requested memory, and when it has to satisfy a memory allocation it > just mmap()'s a page from that file. Correct? Correct. Using this technique the kernel is able to share only some parts with other guest processes. > In addition, *every* syscall generates a SIGTRAP to the UML kernel > process, which handles it. The advantage of SKAS0 over TT is that > memory management syscalls allow the separation of kernel and process > address space, but every other syscall needs to be handled exactly as > in TT: e.g., open() needs to map paths using the UML filesystem, etc. > Right? Correct. As I said, UML is a system call emulator. It uses ptrace() to get notified of every executed system call and emulates it. IOW UML is a ptrace() based Linux sandbox... > Now a final question: according to the above `ps` output, the shared > memory among UML processes is ~13GB each. If the above is correct, > only the UML kernel process should have large shared memory. Is this > due to `top` misreporting shared memory occupation? (CentOS 5.x w/ > stock kernel) Or could it be rather a feature of the program that was > running in the UML? (a data-intensive scientific application) If your UML instance has 512MiB all UML processes (kernel and guest) use together 512MiB. For tools like "top" it looks like as each process would use 512MiB. "top" cannot know that these processes are threads (constructed using clone()) and share all memory. This would only work if UML would use pthreads. Using clone() you can create nearly any kind of (unportable) threads. I don't know whether it's possible to implement SKAS0 using pthreads. -- Thanks, //richard ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user