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

Gleb Natapov glebn at voltaire.com
Wed Feb 15 07:40:00 PST 2006


On Wed, Feb 15, 2006 at 05:33:07PM +0200, Michael S. Tsirkin wrote:
> Quoting r. Gleb Natapov <glebn at voltaire.com>:
> > Suppose you have this code:
> > 
> > char buf[1000];
> > char *prog="/bin/true";
> > 
> > 
> > main()
> > {
> > 	reg_mr (buf, 1000);
> > 	madvise (buf, 1000, DONTCOPY);
> > 	system (prog);
> > }
> > 
> > if buf and prog are on the same page (most certainly) "/bin/true" will
> > never run. 
> 
> Right, so if you hide madvise inside reg_mr you create a problem.
> 
The problem exists no matter who calls madvise and unfortunately
programmer should be aware of it. To make each rdma developer to
reimplement refcounting only to be sure he is aware about the problem is
cruel IMHO :)

--
			Gleb.



More information about the general mailing list