[openib-general] Re: Re: madvise MADV_DONTFORK/MADV_DOFORK

Michael S. Tsirkin mst at mellanox.co.il
Mon Mar 13 07:14:20 PST 2006


Quoting r. Gleb Natapov <glebn at voltaire.com>:
> Subject: Re: [openib-general] Re: Re: madvise MADV_DONTFORK/MADV_DOFORK
> 
> On Sun, Mar 12, 2006 at 02:56:49PM +0200, Michael S. Tsirkin wrote:
> > > Do you think new page flag is a viable solution? With the holy war
> > > against new (and old) page flags. Besides fork will have to go from pte to 
> > > struct page to check flags for each mapped page in the process!
> > 
> > I thought about this some more, and I think you are right.
> > Adding overhead on fork and page flags won't fly.
>
> Actually I was wrong about overhead, We already go from pte to page in
> fork. But new flag will be hard to push.

And we still have the early copy overhead.

> > My current thinking then goes vaguely along the lines of:
> > 
> > We need a way to distinguish the parent from child on COW. A flag in the VMA
> > will do it.
> > 
> And what if child forks ones more?

If COW is already set, we don't set this new flag in VMA.
When the driver does get_user_pages with child's mm, this will break COW
so no problem.

> > Then, when the parent (flag set) writes to the page and COW is activated,
> > and the page is mapped into more than one process, and there is a driver
> > keeping a reference on a page, we need to find everyone who maps the page
> > and fix them to refer to the page copy rather than the original. The parent
> > will still have the original page.
>
> rmap can help here I think.

Care to code something up?

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies



More information about the general mailing list