I don't think copying all the registered memory on fork() is feasible,Suppose a new vma flag is introduced, VM_NOCOW and an API to apply this flag on a range of addreses, splitting or unifying vmas as necessary. A driver which registers memory with hardware would call this function. When fork takes place, the ptes of the parent belonging to such vmas will not be changed to read only thus they will not undergo COW. The kernel will copy the first and last pages of theses vmas to the child. All the pages in between will be marked read only and will undergo COW when written to. One problem would be that that child can read pages of the parent after the parent modifies them but that could be avoided if the address space of the child does not inherit the range of the moddle pages. ???
because it's going to kill performance (especially since exec() is
likely to immediately follow the fork() in the child). Also, there
may not be enough memory around to copy everything.