diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-06-26 20:32:51 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-06-26 20:32:51 +0000 |
commit | e62ef89fc1df8d45376a9512206833cdc638641e (patch) | |
tree | aeaaa6de77668fab79f17e2b343adbadf9d306a2 /sys | |
parent | c3868afc98f44fd1ff3f32ca2a92e673adb92ab9 (diff) | |
download | FreeBSD-src-e62ef89fc1df8d45376a9512206833cdc638641e.zip FreeBSD-src-e62ef89fc1df8d45376a9512206833cdc638641e.tar.gz |
Avoid using the 64-bit vm_pindex_t in a few places where 64-bit
types are not required, as the overhead is unnecessary:
o In the i386 pmap_protect(), `sindex' and `eindex' represent page
indices within the 32-bit virtual address space.
o In swp_pager_meta_build() and swp_pager_meta_ctl(), use a temporary
variable to store the low few bits of a vm_pindex_t that gets used
as an array index.
o vm_uiomove() uses `osize' and `idx' for page offsets within a
map entry.
o In vm_object_split(), `idx' is a page offset within a map entry.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/pmap.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 2 | ||||
-rw-r--r-- | sys/vm/swap_pager.c | 26 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 5 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 4 |
5 files changed, 21 insertions, 18 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 17bcd80..9f380d6 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2010,7 +2010,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) register pt_entry_t *ptbase; vm_offset_t pdnxt; pd_entry_t ptpaddr; - vm_pindex_t sindex, eindex; + vm_offset_t sindex, eindex; int anychanged; if (pmap == NULL) diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 17bcd80..9f380d6 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2010,7 +2010,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) register pt_entry_t *ptbase; vm_offset_t pdnxt; pd_entry_t ptpaddr; - vm_pindex_t sindex, eindex; + vm_offset_t sindex, eindex; int anychanged; if (pmap == NULL) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 3dd7279..dfe34da 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1678,11 +1678,12 @@ swp_pager_hash(vm_object_t object, vm_pindex_t index) static void swp_pager_meta_build( vm_object_t object, - vm_pindex_t index, + vm_pindex_t pindex, daddr_t swapblk ) { struct swblock *swap; struct swblock **pswap; + int idx; GIANT_REQUIRED; /* @@ -1715,7 +1716,7 @@ swp_pager_meta_build( * and, since the hash table may have changed, retry. */ retry: - pswap = swp_pager_hash(object, index); + pswap = swp_pager_hash(object, pindex); if ((swap = *pswap) == NULL) { int i; @@ -1731,7 +1732,7 @@ retry: swap->swb_hnext = NULL; swap->swb_object = object; - swap->swb_index = index & ~(vm_pindex_t)SWAP_META_MASK; + swap->swb_index = pindex & ~(vm_pindex_t)SWAP_META_MASK; swap->swb_count = 0; ++object->un_pager.swp.swp_bcount; @@ -1743,17 +1744,17 @@ retry: /* * Delete prior contents of metadata */ - index &= SWAP_META_MASK; + idx = pindex & SWAP_META_MASK; - if (swap->swb_pages[index] != SWAPBLK_NONE) { - swp_pager_freeswapspace(swap->swb_pages[index], 1); + if (swap->swb_pages[idx] != SWAPBLK_NONE) { + swp_pager_freeswapspace(swap->swb_pages[idx], 1); --swap->swb_count; } /* * Enter block into metadata */ - swap->swb_pages[index] = swapblk; + swap->swb_pages[idx] = swapblk; if (swapblk != SWAPBLK_NONE) ++swap->swb_count; } @@ -1877,12 +1878,13 @@ swp_pager_meta_free_all(vm_object_t object) static daddr_t swp_pager_meta_ctl( vm_object_t object, - vm_pindex_t index, + vm_pindex_t pindex, int flags ) { struct swblock **pswap; struct swblock *swap; daddr_t r1; + int idx; GIANT_REQUIRED; /* @@ -1893,11 +1895,11 @@ swp_pager_meta_ctl( return (SWAPBLK_NONE); r1 = SWAPBLK_NONE; - pswap = swp_pager_hash(object, index); + pswap = swp_pager_hash(object, pindex); if ((swap = *pswap) != NULL) { - index &= SWAP_META_MASK; - r1 = swap->swb_pages[index]; + idx = pindex & SWAP_META_MASK; + r1 = swap->swb_pages[idx]; if (r1 != SWAPBLK_NONE) { if (flags & SWM_FREE) { @@ -1905,7 +1907,7 @@ swp_pager_meta_ctl( r1 = SWAPBLK_NONE; } if (flags & (SWM_FREE|SWM_POP)) { - swap->swb_pages[index] = SWAPBLK_NONE; + swap->swb_pages[idx] = SWAPBLK_NONE; if (--swap->swb_count == 0) { *pswap = swap->swb_hnext; uma_zfree(swap_zone, swap); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 50fc1b9..437a0ce 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2835,7 +2835,8 @@ vm_uiomove( boolean_t wired; int tcnt, rv; vm_offset_t uaddr, start, end, tend; - vm_pindex_t first_pindex, osize, oindex; + vm_pindex_t first_pindex, oindex; + vm_size_t osize; off_t ooffset; int cnt; @@ -2874,7 +2875,7 @@ vm_uiomove( oindex = OFF_TO_IDX(cp); if (npages) { - vm_pindex_t idx; + vm_size_t idx; for (idx = 0; idx < osize; idx++) { vm_page_t m; if ((m = vm_page_lookup(srcobject, oindex + idx)) == NULL) { diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 584854d..f86a653 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1208,8 +1208,8 @@ vm_object_split(vm_map_entry_t entry) vm_page_t m; vm_object_t orig_object, new_object, source; vm_offset_t s, e; - vm_pindex_t offidxstart, offidxend, idx; - vm_size_t size; + vm_pindex_t offidxstart, offidxend; + vm_size_t idx, size; vm_ooffset_t offset; GIANT_REQUIRED; |