On Tue, Jul 14, 2020 at 12:10:47PM -0700, Ira Weiny wrote: > On Tue, Jul 14, 2020 at 10:40:57AM +0200, Peter Zijlstra wrote: > > That's an anti-pattern vs static_keys, I'm thinking you actually want > > static_key_slow_{inc,dec}() instead of {enable,disable}(). > > Thanks. I'll go read the doc for those as I'm not familiar with them. Look for static_branch_{inc,dec} in include/linux/jump_label.h, it basically does the refcount thing you need and does the actual transition on the 0->1 and 1->0 transitions.