diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_exec.c | 8 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 4 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 38 |
4 files changed, 32 insertions, 32 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e7c598f460c..f262c99a7bb 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.102 2007/03/15 10:22:30 art Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.103 2007/09/15 10:10:37 martin Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -411,11 +411,11 @@ sys_execve(struct proc *p, void *v, register_t *retval) vm = p->p_vmspace; /* Now map address space */ vm->vm_taddr = (char *)pack.ep_taddr; - vm->vm_tsize = btoc(pack.ep_tsize); + vm->vm_tsize = atop(round_page(pack.ep_tsize)); vm->vm_daddr = (char *)pack.ep_daddr; - vm->vm_dsize = btoc(pack.ep_dsize); + vm->vm_dsize = atop(round_page(pack.ep_dsize)); vm->vm_dused = 0; - vm->vm_ssize = btoc(pack.ep_ssize); + vm->vm_ssize = atop(round_page(pack.ep_ssize)); vm->vm_maxsaddr = (char *)pack.ep_maxsaddr; vm->vm_minsaddr = (char *)pack.ep_minsaddr; diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index d0bdf1bba23..a344160b7ed 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.72 2007/09/07 10:22:15 art Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.73 2007/09/15 10:10:37 martin Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -201,7 +201,7 @@ malloc(unsigned long size, int type, int flags) allocsize = round_page(size); else allocsize = 1 << indx; - npg = btoc(allocsize); + npg = atop(round_page(allocsize)); va = (caddr_t) uvm_km_kmemalloc(kmem_map, NULL, (vsize_t)ptoa(npg), ((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) | diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 538f530efaf..9d1c0ccf2ef 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.48 2007/09/07 15:00:20 art Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.49 2007/09/15 10:10:37 martin Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -155,7 +155,7 @@ shm_deallocate_segment(struct shmid_ds *shmseg) size = round_page(shmseg->shm_segsz); uao_detach(shm_handle->shm_object); pool_put(&shm_pool, shmseg); - shm_committed -= btoc(size); + shm_committed -= atop(size); shm_nused--; } @@ -400,10 +400,10 @@ shmget_allocate_segment(struct proc *p, if (shm_nused >= shminfo.shmmni) /* any shmids left? */ return (ENOSPC); size = round_page(SCARG(uap, size)); - if (shm_committed + btoc(size) > shminfo.shmall) + if (shm_committed + atop(size) > shminfo.shmall) return (ENOMEM); shm_nused++; - shm_committed += btoc(size); + shm_committed += atop(size); /* * If a key has been specified and we had to wait for memory @@ -417,7 +417,7 @@ shmget_allocate_segment(struct proc *p, if (shm_find_segment_by_key(key) != -1) { pool_put(&shm_pool, shmseg); shm_nused--; - shm_committed -= btoc(size); + shm_committed -= atop(size); return (EAGAIN); } } @@ -576,8 +576,8 @@ sysctl_sysvshm(int *name, u_int namelen, void *oldp, size_t *oldlenp, return (error); /* If new shmmax > shmall, crank shmall */ - if (btoc(round_page(shminfo.shmmax)) > shminfo.shmall) - shminfo.shmall = btoc(round_page(shminfo.shmmax)); + if (atop(round_page(shminfo.shmmax)) > shminfo.shmall) + shminfo.shmall = atop(round_page(shminfo.shmmax)); return (0); case KERN_SHMINFO_SHMMIN: val = shminfo.shmmin; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d70e8d577c4..b40113a0844 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.99 2007/08/07 04:32:45 beck Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.100 2007/09/15 10:10:37 martin Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -180,14 +180,14 @@ bremfree(struct buf *bp) if (dp == &bufqueues[BQUEUES]) panic("bremfree: lost tail"); } - numfreepages -= btoc(bp->b_bufsize); + numfreepages -= atop(bp->b_bufsize); if (!ISSET(bp->b_flags, B_DELWRI)) { int qs = bp->b_bufsize; queue = size2cqueue(&qs); - numcleanpages -= btoc(bp->b_bufsize); - bqpages[queue] -= btoc(bp->b_bufsize); + numcleanpages -= atop(bp->b_bufsize); + bqpages[queue] -= atop(bp->b_bufsize); } else - numdirtypages -= btoc(bp->b_bufsize); + numdirtypages -= atop(bp->b_bufsize); TAILQ_REMOVE(dp, bp, b_freelist); } @@ -198,7 +198,7 @@ buf_init(struct buf *bp, int size) splassert(IPL_BIO); - npages = btoc(size); + npages = atop(size); bzero((char *)bp, sizeof *bp); bp->b_vnbufs.le_next = NOLIST; bp->b_freelist.tqe_next = NOLIST; @@ -274,7 +274,7 @@ buf_get(size_t size) size = round_page(size); qs = size; queue = size2cqueue(&qs); - npages = btoc(qs); + npages = atop(qs); if (numbufpages + npages > bufpages) return (NULL); @@ -323,7 +323,7 @@ buf_put(struct buf *bp) if (bp->b_data != NULL) { bremhash(bp); - numbufpages -= btoc(bp->b_bufsize); + numbufpages -= atop(bp->b_bufsize); uvm_km_free(buf_map, (vaddr_t)bp->b_data, bp->b_bufsize); } @@ -365,8 +365,8 @@ bufinit(void) */ hicleanpages = bufpages / 2; locleanpages = hicleanpages / 2; - if (locleanpages < btoc(2 * MAXBSIZE)) - locleanpages = btoc(2 * MAXBSIZE); + if (locleanpages < atop(2 * MAXBSIZE)) + locleanpages = atop(2 * MAXBSIZE); if (locleanpages > bufpages / 4) locleanpages = bufpages / 4; @@ -782,8 +782,8 @@ brelse(struct buf *bp) qs = bp->b_bufsize; queue = size2cqueue(&qs); - numcleanpages += btoc(bp->b_bufsize); - bqpages[queue] += btoc(bp->b_bufsize); + numcleanpages += atop(bp->b_bufsize); + bqpages[queue] += atop(bp->b_bufsize); if (maxcleanpages < numcleanpages) maxcleanpages = numcleanpages; binsheadfree(bp, &bufqueues[queue]); @@ -793,18 +793,18 @@ brelse(struct buf *bp) * queue, so that it'll stick around for as long as possible. */ int queue, qs; - numfreepages += btoc(bp->b_bufsize); + numfreepages += atop(bp->b_bufsize); qs = bp->b_bufsize; queue = size2cqueue(&qs); if (!ISSET(bp->b_flags, B_DELWRI)) { - numcleanpages += btoc(bp->b_bufsize); - bqpages[queue] += btoc(bp->b_bufsize); + numcleanpages += atop(bp->b_bufsize); + bqpages[queue] += atop(bp->b_bufsize); if (maxcleanpages < numcleanpages) maxcleanpages = numcleanpages; bufq = &bufqueues[queue]; } else { - numdirtypages += btoc(bp->b_bufsize); + numdirtypages += atop(bp->b_bufsize); bufq = &bufqueues[BQ_DIRTY]; } if (ISSET(bp->b_flags, B_AGE)) { @@ -1110,8 +1110,8 @@ buf_daemon(struct proc *p) buf_countdeps(bp, 0, 0)) { SET(bp->b_flags, B_DEFERRED); s = splbio(); - numfreepages += btoc(bp->b_bufsize); - numdirtypages += btoc(bp->b_bufsize); + numfreepages += atop(bp->b_bufsize); + numdirtypages += atop(bp->b_bufsize); binstailfree(bp, &bufqueues[BQ_DIRTY]); CLR(bp->b_flags, B_BUSY); continue; @@ -1237,7 +1237,7 @@ vfs_bufstats(void) TAILQ_FOREACH(bp, dp, b_freelist) { counts[bp->b_bufsize/PAGE_SIZE]++; count++; - pages += btoc(bp->b_bufsize); + pages += atop(bp->b_bufsize); } totals[i] = count; ptotals[i] = pages; |