> What follows is a somewhat older mail I had forgotten about. It's
> suddenly become more interesting to be because I was playing around with
> jruby which requires a big heap size. It pisses me off to own a 3GB
> laptop and only be able to use 1GB of that memory.
>
> This does 2.5 things.
>
> 1. If uvm_mmap fails to find memory in the normal mmap area, go back
> again and look for memory somewhere else (brk). We only do this after
> failure, to preserve the brk space as long as possible.
This is something I have wanted to do for a long time.
> Index: uvm/uvm_map.c
> ===================================================================
> RCS file: /cvs/src/sys/uvm/uvm_map.c,v
> retrieving revision 1.127
> diff -u -r1.127 uvm_map.c
> --- uvm/uvm_map.c 17 Jun 2010 16:11:20 -0000 1.127
> +++ uvm/uvm_map.c 30 Jun 2010 02:17:35 -0000
> @@ -1226,7 +1226,7 @@
> * creating a new mapping with "prot" protection.
> */
> vaddr_t
> -uvm_map_hint(struct proc *p, vm_prot_t prot)
> +uvm_map_hint(struct proc *p, vm_prot_t prot, int invadeheap)
> {
> vaddr_t addr;
>
> @@ -1242,9 +1242,11 @@
> return (round_page(addr));
> }
> #endif
> - addr = (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ;
> + addr = (vaddr_t)p->p_vmspace->vm_daddr;
> + if (!invadeheap)
> + addr += BRKSIZ;
> #if !defined(__vax__)
> - addr += arc4random() & (MIN((256 * 1024 * 1024), MAXDSIZ) - 1);
> + addr += arc4random() & (MIN((256 * 1024 * 1024), BRKSIZ) - 1);
> #else
> /* start malloc/mmap after the brk */
> addr = (vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ;
The way this is written, invadeheap will never have any effect on vax.
Shouldn't this become something like:
addr = ...
if (!invadeheap)
addr +=
#if !defined(__vax__)
addr += randomness
#endif
Miod