[openib-general] Re: [resend][RFC][PATCH] adding call to madvise

Gleb Natapov glebn at voltaire.com
Wed May 17 22:45:58 PDT 2006


On Thu, May 18, 2006 at 07:24:27AM +0300, Michael S. Tsirkin wrote:
> Quoting r. Gleb Natapov <glebn at voltaire.com>:
> > @@ -187,8 +194,8 @@ int ibv_lock_range(void *base, size_t si
> >  
> >  
> >  		if (node->refcnt++ == 0) {
> > -			ret = mlock((void *) node->start,
> > -				    node->end - node->start + 1);
> > +			ret = madvise((void *) node->start,
> > +				    node->end - node->start + 1, MADV_DONTFORK);
> >  			if (ret)
> >  				goto out;
> >  		}
> 
> Will this break libibverbs on older kernels that don't have madvise?
> Maybe test MADV_DONTFORK during library startup and set a flag?
> 
madvise is always there, but older kernels will return EINVAL and we
don't check return value of ibv_lock_range() in ibv_reg_mr() so no harm is
done. It is possible to test for MADV_DONTFORK support during libibvervs
init and disable all madvise pathes if it is not available, but then we
will have two different configuration to test with no much gain.

--
			Gleb.



More information about the general mailing list