cvs commit: src/sys/kern kern_proc.c

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jun 9 18:15:05 GMT 2004


In message <20040609180642.GA33304 at freefall.freebsd.org>, Bosko Milekic writes:

>  While this idea is initially appealing, you should be aware that
>  it is not as straight-forward as it sounds.
>
>  Namely, it is sometimes more advantageous to protect the manipulation
>  of the reference count within a section of code already protected by
>  an appropriate object mutex, and other times (in the absence of a mutex),
>  it might be more advantageous to use atomic ops (no need for a mutex,
>  slightly less costly per-instance).  So defining an API that does one
>  OR the other might not always be appropriate.

A still hot from the oven example of this is the code I just added
in kern/tty.c:  ttyrel() needs to do more locking than ttyref() because
it might unlink the tty from a TAILQ whereas ttyref() will never touch
the TAILQ.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the cvs-all mailing list