diff options
author | jchandra <jchandra@FreeBSD.org> | 2010-07-21 09:27:00 +0000 |
---|---|---|
committer | jchandra <jchandra@FreeBSD.org> | 2010-07-21 09:27:00 +0000 |
commit | 10dfd55de4c36ba1bf848c6973ffea562904c58a (patch) | |
tree | 3eec17c60bcda26e4e936937b8f883b4c7a68bb7 /sys/mips/include/vmparam.h | |
parent | fbd45b20c30db99fedc41b36dfb0d325d0c2cec3 (diff) | |
download | FreeBSD-src-10dfd55de4c36ba1bf848c6973ffea562904c58a.zip FreeBSD-src-10dfd55de4c36ba1bf848c6973ffea562904c58a.tar.gz |
Redo the page table page allocation on MIPS, as suggested by
alc@.
The UMA zone based allocation is replaced by a scheme that creates
a new free page list for the KSEG0 region, and a new function
in sys/vm that allocates pages from a specific free page list.
This also fixes a race condition introduced by the UMA based page table
page allocation code. Dropping the page queue and pmap locks before
the call to uma_zfree, and re-acquiring them afterwards will introduce
a race condtion(noted by alc@).
The changes are :
- Revert the earlier changes in MIPS pmap.c that added UMA zone for
page table pages.
- Add a new freelist VM_FREELIST_HIGHMEM to MIPS vmparam.h for memory that
is not directly mapped (in 32bit kernel). Normal page allocations will first
try the HIGHMEM freelist and then the default(direct mapped) freelist.
- Add a new function 'vm_page_t vm_page_alloc_freelist(int flind, int
order, int req)' to vm/vm_page.c to allocate a page from a specified
freelist. The MIPS page table pages will be allocated using this function
from the freelist containing direct mapped pages.
- Move the page initialization code from vm_phys_alloc_contig() to a
new function vm_page_alloc_init(), and use this function to initialize
pages in vm_page_alloc_freelist() too.
- Split the function vm_phys_alloc_pages(int pool, int order) to create
vm_phys_alloc_freelist_pages(int flind, int pool, int order), and use
this function from both vm_page_alloc_freelist() and vm_phys_alloc_pages().
Reviewed by: alc
Diffstat (limited to 'sys/mips/include/vmparam.h')
-rw-r--r-- | sys/mips/include/vmparam.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/mips/include/vmparam.h b/sys/mips/include/vmparam.h index 6f45244..e09f6a2 100644 --- a/sys/mips/include/vmparam.h +++ b/sys/mips/include/vmparam.h @@ -125,7 +125,6 @@ #define VM_NRESERVLEVEL 0 #endif - /* virtual sizes (bytes) for various kernel submaps */ #ifndef VM_KMEM_SIZE #define VM_KMEM_SIZE (12 * 1024 * 1024) @@ -174,13 +173,24 @@ #define VM_FREEPOOL_DIRECT 1 /* - * we support 1 free list: + * we support 2 free lists: * - * - DEFAULT for all systems + * - DEFAULT for direct mapped (KSEG0) pages. + * Note: This usage of DEFAULT may be misleading because we use + * DEFAULT for allocating direct mapped pages. The normal page + * allocations use HIGHMEM if available, and then DEFAULT. + * - HIGHMEM for other pages */ - +#ifdef __mips_n64 #define VM_NFREELIST 1 #define VM_FREELIST_DEFAULT 0 +#else +#define VM_NFREELIST 2 +#define VM_FREELIST_DEFAULT 1 +#define VM_FREELIST_HIGHMEM 0 +#define VM_FREELIST_DIRECT VM_FREELIST_DEFAULT +#define VM_HIGHMEM_ADDRESS ((vm_paddr_t)0x20000000) +#endif /* * The largest allocation size is 1MB. |