summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-06-25 22:14:06 +0000
committeriedowse <iedowse@FreeBSD.org>2002-06-25 22:14:06 +0000
commit0f26e30daed1edaf8ae7da0ea9486a0cc8ac37cb (patch)
treedcbda8b0d8b9bffec8f0720344fd0c7b3d82fbae
parent7083248242e1c7a83b28b1fc65d49288d0194900 (diff)
downloadFreeBSD-src-0f26e30daed1edaf8ae7da0ea9486a0cc8ac37cb.zip
FreeBSD-src-0f26e30daed1edaf8ae7da0ea9486a0cc8ac37cb.tar.gz
Complete the initial set of VM changes required to support full
64-bit file sizes. This step simply addresses the remaining overflows, and does attempt to optimise performance. The details are: o Use a 64-bit type for the vm_object `size' and the size argument to vm_object_allocate(). o Use the correct type for index variables in dev_pager_getpages(), vm_object_page_clean() and vm_object_page_remove(). o Avoid an overflow in the i386 pmap_object_init_pt().
-rw-r--r--sys/amd64/amd64/pmap.c8
-rw-r--r--sys/i386/i386/pmap.c8
-rw-r--r--sys/vm/device_pager.c2
-rw-r--r--sys/vm/vm_object.c8
-rw-r--r--sys/vm/vm_object.h6
5 files changed, 12 insertions, 20 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index d3478d2..17bcd80 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2493,14 +2493,10 @@ retry:
((objpgs > 0) && (p != NULL));
p = TAILQ_NEXT(p, listq)) {
- tmpidx = p->pindex;
- if (tmpidx < pindex) {
- continue;
- }
- tmpidx -= pindex;
- if (tmpidx >= psize) {
+ if (p->pindex < pindex || p->pindex - pindex > psize) {
continue;
}
+ tmpidx = p->pindex - pindex;
/*
* don't allow an madvise to blow away our really
* free pages allocating pv entries.
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index d3478d2..17bcd80 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -2493,14 +2493,10 @@ retry:
((objpgs > 0) && (p != NULL));
p = TAILQ_NEXT(p, listq)) {
- tmpidx = p->pindex;
- if (tmpidx < pindex) {
- continue;
- }
- tmpidx -= pindex;
- if (tmpidx >= psize) {
+ if (p->pindex < pindex || p->pindex - pindex > psize) {
continue;
}
+ tmpidx = p->pindex - pindex;
/*
* don't allow an madvise to blow away our really
* free pages allocating pv entries.
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index 4eb4ebd..890d068 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -201,7 +201,7 @@ dev_pager_getpages(object, m, count, reqpage)
int count;
int reqpage;
{
- vm_offset_t offset;
+ vm_pindex_t offset;
vm_offset_t paddr;
vm_page_t page;
dev_t dev;
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index b07d6b8..33b597b 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -187,7 +187,7 @@ vm_object_zinit(void *mem, int size)
}
void
-_vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object)
+_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
{
static int object_hash_rand;
int exp, incr;
@@ -341,7 +341,7 @@ vm_object_pip_wait(vm_object_t object, char *waitid)
* Returns a new object with the given size.
*/
vm_object_t
-vm_object_allocate(objtype_t type, vm_size_t size)
+vm_object_allocate(objtype_t type, vm_pindex_t size)
{
vm_object_t result;
@@ -626,7 +626,7 @@ void
vm_object_page_clean(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int flags)
{
vm_page_t p, np;
- vm_offset_t tstart, tend;
+ vm_pindex_t tstart, tend;
vm_pindex_t pi;
struct vnode *vp;
int clearobjflags;
@@ -1697,7 +1697,7 @@ void
vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, boolean_t clean_only)
{
vm_page_t p, next;
- unsigned int size;
+ vm_pindex_t size;
int all;
if (object == NULL)
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 53db319..65e32af 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -93,7 +93,7 @@ struct vm_object {
TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
TAILQ_HEAD(, vm_page) memq; /* list of resident pages */
int generation; /* generation ID */
- vm_size_t size; /* Object size */
+ vm_pindex_t size; /* Object size */
int ref_count; /* How many refs?? */
int shadow_count; /* how many objects that this is a shadow for */
int hash_rand; /* (c) hash table randomizer */
@@ -182,8 +182,8 @@ void vm_object_pip_wakeupn(vm_object_t object, short i);
void vm_object_pip_sleep(vm_object_t object, char *waitid);
void vm_object_pip_wait(vm_object_t object, char *waitid);
-vm_object_t vm_object_allocate (objtype_t, vm_size_t);
-void _vm_object_allocate (objtype_t, vm_size_t, vm_object_t);
+vm_object_t vm_object_allocate (objtype_t, vm_pindex_t);
+void _vm_object_allocate (objtype_t, vm_pindex_t, vm_object_t);
boolean_t vm_object_coalesce (vm_object_t, vm_pindex_t, vm_size_t, vm_size_t);
void vm_object_collapse (vm_object_t);
void vm_object_deallocate (vm_object_t);
OpenPOWER on IntegriCloud