tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Atomic vcache_tryvget()



Hi,

This change makes vcache_tryvget() do its work by means of a single atomic
operation, which removes the need to take v_interlock beforehand.

There are two reasons I want that: it reduces the contention on v_interlock
during build.sh to near-zero, and it gets us a lot closer to a situation
where it's possible to use vcache_tryvget() where the caller cannot tolerate
blocking, for example in a pserialize/RCU type lookup where no other locks
are held.

Unfortunately the change is a little bit ugly.  Two things need to be tested
simultaneously and are combined into a single 32-bit field: vnode state and
vnode usecount.

The core of the change is here:

	http://www.netbsd.org/~ad/2020/vget1.diff

Boring changes for vp->v_usecount -> vusecount(vp) are here:

	http://www.netbsd.org/~ad/2020/vget2.diff

Comments welcome.

Thanks,
Andrew



Home | Main Index | Thread Index | Old Index