diff options
author | alc <alc@FreeBSD.org> | 2003-07-27 20:57:53 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-07-27 20:57:53 +0000 |
commit | 77428ed1a0e9bb2a0f37953186c743a7e53e805a (patch) | |
tree | a847ea1c8f14a4f6825aaf9d6f89e5c18cb9c25f /sys | |
parent | 7223dbc5856e1015f30406abb36853e9d6d9d1ab (diff) | |
download | FreeBSD-src-77428ed1a0e9bb2a0f37953186c743a7e53e805a.zip FreeBSD-src-77428ed1a0e9bb2a0f37953186c743a7e53e805a.tar.gz |
Make pmap_pvo_allocf() callable without Giant.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/powerpc/aim/mmu_oea.c | 12 | ||||
-rw-r--r-- | sys/powerpc/powerpc/mmu_oea.c | 12 | ||||
-rw-r--r-- | sys/powerpc/powerpc/pmap.c | 12 |
3 files changed, 18 insertions, 18 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 1249adb..0ef6e0d 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -246,8 +246,6 @@ uma_zone_t pmap_upvo_zone; /* zone for pvo entries for unmanaged pages */ uma_zone_t pmap_mpvo_zone; /* zone for pvo entries for managed pages */ struct vm_object pmap_upvo_zone_obj; struct vm_object pmap_mpvo_zone_obj; -static vm_object_t pmap_pvo_obj; -static u_int pmap_pvo_count; #define BPVO_POOL_SIZE 32768 static struct pvo_entry *pmap_bpvo_pool; @@ -1068,8 +1066,6 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) CTR0(KTR_PMAP, "pmap_init"); - pmap_pvo_obj = vm_object_allocate(OBJT_PHYS, 16); - pmap_pvo_count = 0; pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); uma_zone_set_allocf(pmap_upvo_zone, pmap_pvo_allocf); @@ -1976,16 +1972,20 @@ pmap_pvo_to_pte(const struct pvo_entry *pvo, int pteidx) static void * pmap_pvo_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { + static vm_pindex_t color; vm_page_t m; if (bytes != PAGE_SIZE) panic("pmap_pvo_allocf: benno was shortsighted. hit him."); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(pmap_pvo_obj, pmap_pvo_count, VM_ALLOC_SYSTEM); + /* + * The color is only a hint. Thus, a data race in the read- + * modify-write operation below isn't a catastrophe. + */ + m = vm_page_alloc(NULL, color++, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM); if (m == NULL) return (NULL); - pmap_pvo_count++; return ((void *)VM_PAGE_TO_PHYS(m)); } diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 1249adb..0ef6e0d 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -246,8 +246,6 @@ uma_zone_t pmap_upvo_zone; /* zone for pvo entries for unmanaged pages */ uma_zone_t pmap_mpvo_zone; /* zone for pvo entries for managed pages */ struct vm_object pmap_upvo_zone_obj; struct vm_object pmap_mpvo_zone_obj; -static vm_object_t pmap_pvo_obj; -static u_int pmap_pvo_count; #define BPVO_POOL_SIZE 32768 static struct pvo_entry *pmap_bpvo_pool; @@ -1068,8 +1066,6 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) CTR0(KTR_PMAP, "pmap_init"); - pmap_pvo_obj = vm_object_allocate(OBJT_PHYS, 16); - pmap_pvo_count = 0; pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); uma_zone_set_allocf(pmap_upvo_zone, pmap_pvo_allocf); @@ -1976,16 +1972,20 @@ pmap_pvo_to_pte(const struct pvo_entry *pvo, int pteidx) static void * pmap_pvo_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { + static vm_pindex_t color; vm_page_t m; if (bytes != PAGE_SIZE) panic("pmap_pvo_allocf: benno was shortsighted. hit him."); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(pmap_pvo_obj, pmap_pvo_count, VM_ALLOC_SYSTEM); + /* + * The color is only a hint. Thus, a data race in the read- + * modify-write operation below isn't a catastrophe. + */ + m = vm_page_alloc(NULL, color++, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM); if (m == NULL) return (NULL); - pmap_pvo_count++; return ((void *)VM_PAGE_TO_PHYS(m)); } diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 1249adb..0ef6e0d 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -246,8 +246,6 @@ uma_zone_t pmap_upvo_zone; /* zone for pvo entries for unmanaged pages */ uma_zone_t pmap_mpvo_zone; /* zone for pvo entries for managed pages */ struct vm_object pmap_upvo_zone_obj; struct vm_object pmap_mpvo_zone_obj; -static vm_object_t pmap_pvo_obj; -static u_int pmap_pvo_count; #define BPVO_POOL_SIZE 32768 static struct pvo_entry *pmap_bpvo_pool; @@ -1068,8 +1066,6 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) CTR0(KTR_PMAP, "pmap_init"); - pmap_pvo_obj = vm_object_allocate(OBJT_PHYS, 16); - pmap_pvo_count = 0; pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); uma_zone_set_allocf(pmap_upvo_zone, pmap_pvo_allocf); @@ -1976,16 +1972,20 @@ pmap_pvo_to_pte(const struct pvo_entry *pvo, int pteidx) static void * pmap_pvo_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { + static vm_pindex_t color; vm_page_t m; if (bytes != PAGE_SIZE) panic("pmap_pvo_allocf: benno was shortsighted. hit him."); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(pmap_pvo_obj, pmap_pvo_count, VM_ALLOC_SYSTEM); + /* + * The color is only a hint. Thus, a data race in the read- + * modify-write operation below isn't a catastrophe. + */ + m = vm_page_alloc(NULL, color++, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM); if (m == NULL) return (NULL); - pmap_pvo_count++; return ((void *)VM_PAGE_TO_PHYS(m)); } |