tech-kern archive

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

Re: Debugging function of localcount



> Date: Mon, 13 Nov 2017 13:59:32 +0900
> From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>
> 
> I'm sorry for not replying this thread. I'm back.
> 
> I've revised the patch as your suggestions:
>   http://www.netbsd.org/~ozaki-r/localcount_debug_atomic.revised.diff

Looks better, thanks!

Couple nits:

1. Still need to volatile-qualify lc_refcnt.
2. Either use unsigned and atomic_cas_uint, or uint32_t and
   atomic_cas_32, but not a mixture.

Random thought: What about a per-LWP counter for diagnostics, with
lwp_getspecific/setspecific?  No interprocessor overhead that way.
Could even assert when an lwp exits, or when a softint returns, that
no localcounts were leaked.

(This slightly changes the semantics of localcount so that it cannot
be passed from lwp to lwp (i.e., can't acquire in one and release in
the other; must acquire in both and release in both), but I don't
really see a problem with that.)


Home | Main Index | Thread Index | Old Index