s On 06/03/2019 19:42, Ryo Shimizu wrote:
thorpej%me.com@localhost (Jason Thorpe) writes:Might I suggest a reference count? RUN_ONCE() can initialize the mutex around the counter, and then the counter can keep track of the init's and fini's called, and only do the work on the 0->1 edge and the 1->0 edge. You also need to destroy the mutex somewhen. RUN_ONCE needs to learn a bit more about life cycles.I made INIT_ONCE(9) and FINI_ONCE(9) with reference counter. Is this OK like this?
Hi, Thanks for working on this.At the moment your _{init,fini}_once are missing cv_broadcasts, but I wonder if we can merge _{run,init}_once and avoid duplicate code.
I'm not sure if _fini_done should ever wait. Thanks, Nick