Subject: Re: Real vfork() (was: third results)
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: None <jiho@postal.c-zone.net>
List: tech-kern
Date: 04/05/1998 12:38:17
On 05-Apr-98 Jason Thorpe wrote:

>> Ah, but that sharing was made possible by moving the USPACE allocation out
>> of the vmspace.
>
> Uh, the U-area has never been part of the vmspace.  (At least, that I can
> remember...)

The usual garbled facts on my part.

The confusion here started when I read FreeBSD's description of what THEY have
done (always dangerous).

Here's what the RELNOTES say for a snapshot of the FreeBSD 3.0 current tree:

  o The UPAGES are gone from the per-process address space which allows
    complete address space and page table sharing by reference count.

  o Newly forked child processes return directly to user mode rather than
    return up through the fork() syscall tree.  This eliminates the kernel
    stack copy at fork time and simplifies certain other internal operations. 
    It is also needed to support the removal of the UPAGES.  (The idea for
    this originally came from NetBSD, but we did it for different reasons.)

  o vfork() is now fully functional by taking advantage of the new sharing
    semantics....

Meanwhile, the CSRG 4.4BSD book says on page 85:

  The only place that user-structure references still exist are in the _fork_
  system call, where the new process entry has pointers set up to reference the
  two remaining structures that are still allocated in the user structure. 
  Other parts of the kernel that reference these structures are unaware that
  the latter are located in the user structure; the structures are always
  referenced from pointers in the process table.  Changing them to dynamically
  allocated structures would require code changes only in _fork_ to allocate
  them, and _exit_ to free them.

Which, combined with the above, compounded my confusion.

FreeBSD now hands off the allocation of the user structure (*up) to a function
in pmap.c.  This function creates a Mach vm object for it, but still uses
kmem_alloc_pageable() to do the allocation.  So what's going on there and what
they're saying in those RELNOTES is beyond me. 

And as you say, USPACE never has been in the vmspace:  I misread the meaning of
"per-process address space".

What in fact WAS preventing vmspace sharing and the Real vfork(), all these
years?


--Jim Howard  <jiho@mail.c-zone.net>


----------------------------------
E-Mail: jiho@mail.c-zone.net
Date: 05-Apr-98
Time: 12:38:19

This message was sent by XFMail
----------------------------------