On Mon, Sep 2, 2019 at 10:04 AM Eric W. Biederman <ebied...@xmission.com> wrote: > > I like using the storage we will later use for the rcu_head. > > Is the intention your new variable xxx start as 0, and the only > on the second write it becomes 1 and we take action? > > That should work but it is a funny way to encode a decrement. I think > it would be more straight forward to use refcount_dec_and_test. > > So something like this:
I like how this patch looks. It makes more sense to me than some of the ad-hoc cases, and I wonder if this might be a pattern in general. We have a very different "some users don't need RCU" in the dentry code, and recently in the credential handling code. So I wonder if this is a larger pattern, but I think your patch looks good independently on its own. But this is all based on "that patch _feels_ conceptually right", rather than any deep thinking or (God forbid) any actual testing. Linus