diff options
author | kib <kib@FreeBSD.org> | 2013-11-20 08:45:26 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-11-20 08:45:26 +0000 |
commit | 3c8b0e84289d8f66480aa05585c41dccd7dd58a9 (patch) | |
tree | 41810a15d0682deabcae46627f1aca2d0e0da675 /sys/vm | |
parent | 8971da00291e6ea3497292941890591cc136362c (diff) | |
download | FreeBSD-src-3c8b0e84289d8f66480aa05585c41dccd7dd58a9.zip FreeBSD-src-3c8b0e84289d8f66480aa05585c41dccd7dd58a9.tar.gz |
Revert back to use int for the page counts. In vn_io_fault(), the i/o
is chunked to pieces limited by integer io_hold_cnt tunable, while
vm_fault_quick_hold_pages() takes integer max_count as the upper bound.
Rearrange the checks to correctly handle overflowing address arithmetic.
Submitted by: bde
Tested by: pho
Discussed with: alc
MFC after: 1 week
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_fault.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index c553892..4f4015d 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1074,12 +1074,12 @@ vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, { vm_offset_t end, va; vm_page_t *mp; - vm_size_t count; + int count; boolean_t pmap_failed; if (len == 0) return (0); - end = round_page(addr + len); + end = round_page(addr + len); addr = trunc_page(addr); /* @@ -1088,9 +1088,9 @@ vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, if (addr < vm_map_min(map) || addr > end || end > vm_map_max(map)) return (-1); - count = howmany(end - addr, PAGE_SIZE); - if (count > max_count) + if (atop(end - addr) > max_count) panic("vm_fault_quick_hold_pages: count > max_count"); + count = atop(end - addr); /* * Most likely, the physical pages are resident in the pmap, so it is |