Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177575853
D53965.1794784810.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D53965.1794784810.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 && !reserved &&
+ 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,13 @@
* 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 (!swap_reserve_by_cred(atop(charge), prev_object->cred)) {
VM_OBJECT_WUNLOCK(prev_object);
return (FALSE);
}
- prev_object->charge += ptoa(next_size);
+ prev_object->charge += charge;
}
/*
@@ -2226,16 +2228,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
Sun, Nov 15, 11:20 PM (10 m, 17 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41750493
Default Alt Text
D53965.1794784810.diff (1 KB)
Attached To
Mode
D53965: vm_object_coalesce(): do not account holes twice
Attached
Detach File
Event Timeline