Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 18:12:01 -0500
From:      Alan Cox <alc@rice.edu>
To:        Marko Zec <zec@fer.hr>
Cc:        alc@freebsd.org, freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org
Subject:   Re: superpages and kmem on amd64
Message-ID:  <4FB97A41.70405@rice.edu>
In-Reply-To: <201205210048.16877.zec@fer.hr>
References:  <201205200901.32613.zec@fer.hr> <201205201643.01194.zec@fer.hr> <4FB92B22.5020304@rice.edu> <201205210048.16877.zec@fer.hr>

next in thread | previous in thread | raw e-mail | index | archive | help
On 05/20/2012 17:48, Marko Zec wrote:
> On Sunday 20 May 2012 19:34:26 Alan Cox wrote:
> ...
>>> In any case, I wish to be certain that a particular kmem virtual address
>>> range is mapped to superpages - how can I enforce that at malloc time,
>>> and / or find out later if I really got my kmem mapped to superpages?
>>> Perhaps vm_map_lookup() could provide more info, but I'm wondering if
>>> someone already wrote a wrapper function for that, which takes only the
>>> base virtual address as a single argument?
>> Try using pmap_mincore() to verify that the mappings are superpages.
> flags = pmap_mincore(vmspace_pmap(curthread->td_proc->p_vmspace),
> (vm_offset_t) addr));
>
> OK, that works, and now I know my kmem chunk is on a superpage, horray!!!
> Thanks!
>
>>> BTW, apparently malloc(size, M_TEMP, M_NOWAIT) requests fail for size>
>>> 1G, even at boot time.  Any ideas how to circumvent that (8.3-STABLE,
>>> amd64, 4G physical RAM)?
>> I suspect that you need to increase the size of your kmem map.
> Huh any hints how should I achieve that?  In desperation I placed
>
> vm.kmem_size=8G
>
> in /boot/loader.conf and got this:
>
> vm.kmem_map_free: 8123924480
> vm.kmem_map_size: 8364032
> vm.kmem_size_scale: 1
> vm.kmem_size_max: 329853485875
> vm.kmem_size_min: 0
> vm.kmem_size: 8132288512
>
> but malloc(2G) still fails...

Here is at least one reason why it fails:

void *
uma_large_malloc(int size, int wait)

Note the type of "size".  Can you malloc 1GB?





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FB97A41.70405>