On Thu, 2023-07-06 at 01:04 +0200, Pablo Neira Ayuso wrote: > Overflow use refcount checks are not complete. > > Add helper function to deal with object reference counter tracking. > Report -EMFILE in case UINT_MAX is reached. > > nft_use_dec() splats in case that reference counter underflows, > which should not ever happen. For the records, I also once had the need for an non atomic reference counters implementing sanity checks on underflows/overflows. I resorted to use plain refcount_t, since the atomic op overhead was not noticeable in my use-case. [not blocking this series, just thinking aloud] I'm wondering if a generic, non-atomic refcounter infra could be useful? Cheers, Paolo