> copy_page_range
> Intead of copying the page tables, just increment their use counts
>
> zap_page_range:
> If a page table is shared according to its use count, just decrement
> the use count and otherwise leave it alone.
>
> handle_mm_fault:
> If a page table is shared according to its use count and the faulting
> instruction is a write, allocate a new page table and do the work that
> would have normally been done by copy_page_range at fork time.
> Decrement the use count of the (perhaps formerly) shared page table.
Somewhere in here, the pages have got to all be marked read-only or
something. If they're not, then either parent or child writing to
non-faulting addresses will be writing to shared memory.
I think something more is needed, such as creating a minimal page table
for the child process with read-only mappings to the current %EIP and %EBP
pages in it. This gets us past the fork/exec hurdle. Without the exec, we
copy over chunks when they're accessed as above in handle_mm_fault. But
you can't actually _share_ the page tables without marking the pages
themselves readonly.
-- "Love the dolphins," she advised him. "Write by W.A.S.T.E.."- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/