cvs commit: src/sys/vm vm_pageout.c

Alan L. Cox alc at imimic.com
Wed Sep 17 19:16:25 PDT 2003


Jeff Roberson wrote:
> 
> On Tue, 16 Sep 2003, Alan Cox wrote:
> 
> > alc         2003/09/16 23:55:42 PDT
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sys/vm               vm_pageout.c
> >   Log:
> >   When calling vget() on a vnode-backed vm object, acquire the vnode
> >   interlock before releasing the vm object's lock.
> >
> >   Revision  Changes    Path
> >   1.243     +3 -2      src/sys/vm/vm_pageout.c
> >
> 
> Very interesting, can you describe the relationship between the vm object
> lock and the interlock?  Why was a reference to the vnode not enough?
> 

I'm trying to make sure that nothing "bad" happens to the vnode between
the time that the vm object lock is released and vget() increments the
vnode's use count.  There would otherwise be a window between the
release of the vm object lock and the acquire of the interlock in
vget().

Consider vm_object_reference(), for example.  If I didn't acquire the
interlock before releasing the vm object lock, it's possible that a
vm_object_deallocate() could jump in, leaving the vm object's reference
count non-zero but causing the vnode's use count to prematurely reach
zero.

Regards,
Alan


More information about the cvs-src mailing list