Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140162272
D54263.id168243.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54263.id168243.diff
View Options
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2200,7 +2200,8 @@
/*
* Account for the charge.
*/
- if (prev_object->cred != NULL) {
+ if (prev_object->cred != NULL &&
+ next_pindex + next_size > prev_object->size) {
/*
* If prev_object was charged, then this mapping,
* although not charged now, may become writable
@@ -2211,12 +2212,14 @@
* entry, and swap reservation for this entry is
* managed in appropriate time.
*/
- if (!reserved && !swap_reserve_by_cred(ptoa(next_size),
- prev_object->cred)) {
+ vm_size_t charge = ptoa(next_pindex + next_size -
+ prev_object->size);
+ if (!reserved &&
+ !swap_reserve_by_cred(charge, prev_object->cred)) {
VM_OBJECT_WUNLOCK(prev_object);
return (FALSE);
}
- prev_object->charge += ptoa(next_size);
+ prev_object->charge += charge;
}
/*
@@ -2226,16 +2229,6 @@
if (next_pindex < prev_object->size) {
vm_object_page_remove(prev_object, next_pindex, next_pindex +
next_size, 0);
-#if 0
- if (prev_object->cred != NULL) {
- KASSERT(prev_object->charge >=
- ptoa(prev_object->size - next_pindex),
- ("object %p overcharged 1 %jx %jx", prev_object,
- (uintmax_t)next_pindex, (uintmax_t)next_size));
- prev_object->charge -= ptoa(prev_object->size -
- next_pindex);
- }
-#endif
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 22, 12:31 AM (9 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27041917
Default Alt Text
D54263.id168243.diff (1 KB)
Attached To
Mode
D54263: vm_object_coalesce(): do not account holes twice
Attached
Detach File
Event Timeline
Log In to Comment