Date: Fri, 27 Sep 2002 19:27:50 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 18253 for review Message-ID: <200209280227.g8S2RoH5036122@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18253 Change 18253 by peter@peter_ia64 on 2002/09/27 19:27:09 unleash great evil. Provide an alternative version of the uma obj_alloc fuction and do great evil to compile and activate it. There is mileage to be had by providing an MD implementation page_alloc/free and obj_alloc. eg: to return everything via the RR7 region using the 256MB page tlb's. Other platforms with direct mapped regions would like this a lot too. Affected files ... .. //depot/projects/ia64/sys/ia64/ia64/pmap.c#35 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia64/pmap.c#35 (text+ko) ==== @@ -117,6 +117,7 @@ #include <vm/vm_pageout.h> #include <vm/vm_pager.h> #include <vm/uma.h> +#include <vm/uma_int.h> /* XXX for obj_alloc clone */ #include <sys/user.h> @@ -226,9 +227,7 @@ * Data for the pv entry allocation mechanism */ static uma_zone_t pvzone; -#if 0 static struct vm_object pvzone_obj; -#endif static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; static int pmap_pagedaemon_waken = 0; static struct pv_entry *pvbootentries; @@ -238,9 +237,7 @@ * Data for allocating PTEs for user processes. */ static uma_zone_t ptezone; -#if 0 static struct vm_object ptezone_obj; -#endif /* * VHPT instrumentation. @@ -265,6 +262,7 @@ static void pmap_remove_all(vm_page_t m); static void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m); static void *pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); +static void *pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); vm_offset_t pmap_steal_memory(vm_size_t size) @@ -488,9 +486,54 @@ pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { *flags = UMA_SLAB_PRIV; + return (void *)kmem_alloc(kernel_map, bytes); +} + +static void * +pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + *flags = UMA_SLAB_PRIV; return (void *)IA64_PHYS_TO_RR7(ia64_tpa(kmem_alloc(kernel_map, bytes))); } +/* Clone of obj_alloc from uma_core.c, but using RR7 */ +static void * +pmap_allocf_obj_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + vm_offset_t zkva; + vm_offset_t retkva; + vm_page_t p; + int pages; + + retkva = 0; + pages = zone->uz_pages; + if (bytes > PAGE_SIZE) + panic("pmap_allocf_obj_r7: indigestion: %d\n", bytes); + + /* + * This looks a little weird since we're getting one page at a time + */ + while (bytes > 0) { + p = vm_page_alloc(zone->uz_obj, pages, + VM_ALLOC_INTERRUPT); + if (p == NULL) + return (NULL); + + zkva = zone->uz_kva + pages * PAGE_SIZE; + if (retkva == 0) + retkva = zkva; + pmap_qenter(zkva, &p, 1); + bytes -= PAGE_SIZE; + pages += 1; + } + + *flags = UMA_SLAB_PRIV; + + /* This is a large chunk of duplicated code for this one special hack */ + /* XXX optimize so that we use VM_PAGE_TO_PHYS(p) instead of pmap_qenter */ + return ((void *)IA64_PHYS_TO_RR7(ia64_tpa(retkva))); +} + /* * Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap @@ -532,7 +575,7 @@ ptezone = uma_zcreate("PT ENTRY", sizeof (struct ia64_lpte), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); - uma_zone_set_allocf(ptezone, pmap_allocf); + uma_zone_set_allocf(ptezone, pmap_allocf_r7); uma_prealloc(ptezone, initial_pvs); /* @@ -559,10 +602,12 @@ TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc); pv_entry_max = shpgperproc * maxproc + vm_page_array_size; pv_entry_high_water = 9 * (pv_entry_max / 10); -#if 0 /* incompatable with pmap_allocf above */ uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max); uma_zone_set_obj(ptezone, &ptezone_obj, pv_entry_max); -#endif + /* XXX override uma_zone_set_obj above */ + ZONE_LOCK(ptezone); + ptezone->uz_allocf = pmap_allocf_obj_r7; + ZONE_UNLOCK(ptezone); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209280227.g8S2RoH5036122>