On Mon, Oct 30, 2023 at 05:02:32PM -1000, Linus Torvalds wrote: > look, if USE_CMPXCHG_LOCKREF is false (on UP, or if spinlock are big > because of spinlock debugging, or whatever), lockref_put_return() will > *always* fail, expecting the caller to deal with that failure. > > So doing a lockref_put_return() without dealing with the failure case > is FUNDAMENTALLY BROKEN. > > Yes, it's an odd function. It's a function that is literally designed > for that dcache use-case, where we have a fast-path and a slow path, > and the "lockref_put_return() fails" is the slow-path that needs to > take the spinlock and do it carefully. > > You *cannot* use that function without failure handling. Really. Put another way, it's a fastpath-only thing. Not sure how much use would it be to slap __must_check on it; a warning along the lines of "DON'T USE UNLESS YOU HAVE READ <archive link>" in lockref.h might be useful. BTW, is there any reason for -128 for marking them dead? Looks like -1 wouldn't be any worse...