Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109570453
D22565.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
D22565.diff
View Options
Index: head/sys/vm/vm_object.c
===================================================================
--- head/sys/vm/vm_object.c
+++ head/sys/vm/vm_object.c
@@ -520,15 +520,22 @@
vm_object_vndeallocate(vm_object_t object)
{
struct vnode *vp = (struct vnode *) object->handle;
+ bool last;
KASSERT(object->type == OBJT_VNODE,
("vm_object_vndeallocate: not a vnode object"));
KASSERT(vp != NULL, ("vm_object_vndeallocate: missing vp"));
+ /* Object lock to protect handle lookup. */
+ last = refcount_release(&object->ref_count);
+ VM_OBJECT_RUNLOCK(object);
+
+ if (!last)
+ return;
+
if (!umtx_shm_vnobj_persistent)
umtx_shm_object_terminated(object);
- VM_OBJECT_WUNLOCK(object);
/* vrele may need the vnode lock. */
vrele(vp);
}
@@ -548,7 +555,7 @@
vm_object_deallocate(vm_object_t object)
{
vm_object_t robject, temp;
- bool last, released;
+ bool released;
while (object != NULL) {
/*
@@ -565,18 +572,22 @@
if (released)
return;
- VM_OBJECT_WLOCK(object);
- KASSERT(object->ref_count != 0,
- ("vm_object_deallocate: object deallocated too many times: %d", object->type));
-
- last = refcount_release(&object->ref_count);
if (object->type == OBJT_VNODE) {
- if (last)
+ VM_OBJECT_RLOCK(object);
+ if (object->type == OBJT_VNODE) {
vm_object_vndeallocate(object);
- else
- VM_OBJECT_WUNLOCK(object);
- return;
+ return;
+ }
+ VM_OBJECT_RUNLOCK(object);
}
+
+ VM_OBJECT_WLOCK(object);
+ KASSERT(object->ref_count > 0,
+ ("vm_object_deallocate: object deallocated too many times: %d",
+ object->type));
+
+ if (refcount_release(&object->ref_count))
+ goto doterm;
if (object->ref_count > 1) {
VM_OBJECT_WUNLOCK(object);
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 8:45 PM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16516443
Default Alt Text
D22565.diff (1 KB)
Attached To
Mode
D22565: Low hanging lock reduction based on semi-const flags.
Attached
Detach File
Event Timeline
Log In to Comment