On Thu, Aug 7, 2014 at 8:48 PM, Ryota Ozaki <ozak...@netbsd.org> wrote: > On Thu, Aug 7, 2014 at 7:57 PM, Greg Troxel <g...@ir.bbn.com> wrote: >> >> Ryota Ozaki <ozak...@netbsd.org> writes: >> >>> BTW, I worry about there is no easy way to >>> know if a function in a critical section >>> blocks/sleeps or not. So I wrote a patch to >>> detect that: http://www.netbsd.org/~ozaki-r/debug-pserialize.diff >>> Is it meaningful? >> >> It seems sensible, but it is very much undercommented. Somewhere, the >> point of the variable, what it means, and why the test is right should >> be explained. > > Agreed. I'll write some notes.
http://www.netbsd.org/~ozaki-r/debug-pserialize.diff I added some comments and made the new variable name more meaningful. How does this look? ozaki-r > >> >> I think the point is that sleep should not be called while pserialize is >> active. And probably preemption shouldn't happen either, so we won't >> get false hits from other threads sleeping. >> >> I realize it's typical to reject adding such comments on the theory that >> everyone should already understand all of this. But the complexity of >> our locking (and memory allocation) is high, and I think it helps >> correctness to be much more explicit about the plan. > > Yes, I think we need some manual equivalent to locking(9) of FreeBSD. > > ozaki-r