svn commit: r208589 - head/sys/mips/mips

C. Jayachandran c.jayachandran at gmail.com
Wed Jun 2 05:01:06 UTC 2010


On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox <alc at cs.rice.edu> wrote:
> On 5/27/2010 5:05 AM, Jayachandran C. wrote:
>>
>> Author: jchandra
>> Date: Thu May 27 10:05:40 2010
>> New Revision: 208589
>> URL: http://svn.freebsd.org/changeset/base/208589
>>
>> Log:
>>   Call VM_WAIT in pmap_ptpgzone_allocf() if  M_WAITOK is set.
>>   Removed unused variable.
>>
>>   Approved by: rrs (mentor)
>>
>>
>
> I'm afraid that this will work some of the time, but not all of the time.
>  Specifically, there is no guarantee that any of the available free (or
> cached) pages after the VM_WAIT will fall within the range of suitable
> physical addresses.  Moreover, and perhaps most worrisome, is that this
> function could do a lot of spinning.  Every time this function sleeps and a
> single page is freed (or cached) by someone else, this function will be
> reawakened.  With a little bad luck, you could spin indefinitely.
>
> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and
> kmem_alloc_attr() don't use VM_WAIT, but instead a function called
> vm_contig_grow_cache().

I had seen the vm_contig_grow_cache() usage, but could not use it as
it was defined as a static function.

I did not want to use contigmalloc()/kmem_alloc_contig() either,
because the pages in that memory region are already direct mapped and
setting up another mapping is not necessary. The overall idea is to
allocate pages in the direct mapped region for the page table entries
so that we don't take a TLB exception while accessing page tables
(which is costly as MIPS has a software TLB exception handler).

Can you suggest the right way to do this? I will make the changes and
send a patch for approval.

Thanks,
JC.


More information about the svn-src-all mailing list