Subject: Re: uvm_map_findspace alignment fallback
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 03/24/2004 14:57:23
On Thu, Mar 25, 2004 at 12:56:02AM +0900, YAMAMOTO Takashi wrote:
> [replying to the a little old mail]
> 
> > > I suspect that current behavoiur has become
> > > 'de facto' so there is a possibility to break something with the
> > > change.
> > 
> > yes.  it's why i mailed. :)
> 
> after grep'ing through syssrc and reading the result,
> i'd say there're few instances that depend on the behaviour.
> only place i've noticed to depend on it is in ubc_init,
> which doesn't likely fail.
> i'd commit the attached diff if no one object.
> 
> YAMAMOTO Takashi

> Index: uvm_bio.c
> ===================================================================
> --- uvm_bio.c	(revision 641)
> +++ uvm_bio.c	(working copy)
> @@ -208,7 +208,11 @@ ubc_init(void)
>  		    ubc_nwins << ubc_winshift, &ubc_object.uobj, 0, (vsize_t)va,
>  		    UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
>  				UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0) {
> -		panic("ubc_init: failed to map ubc_object");
> +		if (uvm_map(kernel_map, (vaddr_t *)&ubc_object.kva,
> +		    ubc_nwins << ubc_winshift, &ubc_object.uobj, 0, 0,
> +		    UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
> +				UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0)
> +			panic("ubc_init: failed to map ubc_object");
>  	}
>  	UVMHIST_INIT(ubchist, 300);
>  }

va was set explicitly to 1. Why this change is needed?



> Index: uvm_map.c
> ===================================================================
> --- uvm_map.c	(revision 641)
> +++ uvm_map.c	(working copy)
> @@ -1651,13 +1651,11 @@ nextgap:
>   wraparound:
>  	UVMHIST_LOG(maphist, "<- failed (wrap around)", 0,0,0,0);
>  
> +	return (NULL);
> +
>   notfound:
> -	if (align != 0) {
> -		UVMHIST_LOG(maphist, "calling recursively, no align",
> -		    0,0,0,0);
> -		return (uvm_map_findspace(map, orig_hint,
> -		    length, result, uobj, uoffset, 0, flags));
> -	}
> +	UVMHIST_LOG(maphist, "<- failed (notfound)", 0,0,0,0);
> +
>  	return (NULL);
>  }
>  

uhm, no objections here.

	Andrey