tech-kern archive

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

Re: Debugging function of localcount



> Date: Wed, 26 Jul 2017 18:41:36 +0900
> From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>
> 
> Oops. I thought we could use percpu_foreach in softint, but
> I was wrong. So localcount_debug_refcnt can be used only
> in thread contexts. And the above assertion shouldn't be
> there. The proposal isn't so much worthwhile ;-<

You also can't access one CPU's count from another CPU -- there's no
memory ordering, so you can easily get wildly inconsistent answers.

Maybe if you did a cross-call to count it up, that would work, but it
sounds like for the cases you had in mind, you can't do a cross-call,
and I'm not sure the view is guaranteed to be stable enough: maybe one
thread decrements the count on CPU 0, then you count 'em up, then the
thread migrates to CPU 1 and increments the count there.  (It is not a
theorem that something like this might violate your assertion, just a
conjecture!)


Home | Main Index | Thread Index | Old Index