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.
This commit is contained in:
iedowse 2002-06-26 20:32:51 +00:00
parent 80de4930f2
commit 8a5fbc944c
5 changed files with 21 additions and 18 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 @@ swp_pager_meta_build(
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 @@ swp_pager_meta_build(
/*
* 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);

View File

@ -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) {

View File

@ -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;