Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jul 2010 13:06:01 -0500
From:      Alan Cox <alc@cs.rice.edu>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        Alan Cox <alc@cs.rice.edu>, mips@FreeBSD.org
Subject:   Re: svn commit: r210460 - head/sys/mips/include
Message-ID:  <4C4DCE89.6070301@cs.rice.edu>
In-Reply-To: <20100726.082444.792475653697373753.imp@bsdimp.com>
References:  <AANLkTik%2BBV6u6fNVX8Ntb-G1yF=vEDh6VqB7Xcb5VtD-@mail.gmail.com>	<20100725.052629.160100930644600654.imp@bsdimp.com>	<4C4D3AC1.8080201@cs.rice.edu> <20100726.082444.792475653697373753.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh wrote:
> In message: <4C4D3AC1.8080201@cs.rice.edu>
>             Alan Cox <alc@cs.rice.edu> writes:
> : M. Warner Losh wrote:
> : > In message:
> : > <AANLkTik+BV6u6fNVX8Ntb-G1yF=vEDh6VqB7Xcb5VtD-@mail.gmail.com>
> : >             "Jayachandran C." <c.jayachandran@gmail.com> writes:
> : > : On Sun, Jul 25, 2010 at 10:18 AM, Alan Cox <alc@cs.rice.edu> wrote:
> : > : > Warner Losh wrote:
> : > : >>
> : > : >> Author: imp
> : > : >> Date: Sun Jul 25 04:19:05 2010
> : > : >> New Revision: 210460
> : > : >> URL: http://svn.freebsd.org/changeset/base/210460
> : > : >>
> : > : >> Log:
> : > : >>  Get N64 building by defining VM_FREELIST_DIRECT to be
> : > : >> VM_FREELIST_DEFAULT.  I believe this is correct, since KX is set
> : > in
> : > : >>  n64, and thus all RAM can be direct mapped.
> : > : : Thanks, this is something I missed in my MIPS page table changes.
> : > : : >
> : > : > Yes, it is.
> : > : : In MIPS 64bit, whole physical memory is direct mapped thru a
> : > XKPHYS
> : > : region. We can use vm_page_alloc() for pmap_alloc_pte_page() and
> : > : VM_WAIT for pmap_grow_pte_page_cache(), is this something we should
> : > : consider?
> : >
> : > Likely.  Any idea what kind of performance difference this would buy
> : > us?
> : >   
> : 
> : As long as n64 has a single free list, there is no point in changing
> : pmap_alloc_pte_page() to use vm_page_alloc().  There may, however, be
> : some point to using VM_WAIT in pmap_grow_pte_page_cache(), because
> : vm_contig_grow_cache() is far more aggressive about paging out dirty
> : pages than VM_WAIT is, and VM_WAIT would suffice.
> : 
> : For what it's worth, fixing pmap_change_wiring() and
> : pmap_page_wired_mappings() is almost certainly more important.
>
> what's broken with them now?
>   

pmap_page_wired_mappings() counts the number of pv entries for the 
specified page that have the pv entry wired flag set to TRUE.  
pmap_enter() correctly initializes this flag.  However, 
pmap_change_wiring() doesn't update the corresponding pv entry flag, 
only the PTE.  So, the count returned by pmap_page_wired_mappings() will 
sometimes be wrong.

In other words, that a particular mapping is wired is being redundantly 
stored in two places, the PTE and the pv entry, but these two places are 
not being consistently maintained.

In the short term, the best fix would be to eliminate the pv entry flag 
and use only the PTE.  That flag is wasting non-trivial memory.

However, in the long run, the use of a PTE bit on a wired flag was 
probably a suboptimal choice for MIPS given the scarcity of bits 
available to software.  For example, spending that bit on a PTE_MANAGED 
flag would save a fair number of cycles, especially now that MIPS is 
configured as VM_PHYSSEG_SPARSE.

That said, in closing, I would reiterate that the best fix for the 
foreseeable future is to eliminate the redundant pv entry flag.

Alan




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