On Thu, 11 Mar 2021 13:56:15 +0800 Yejune Deng <yejune.d...@gmail.com> wrote:

> refcount_t type should be used instead of atomic_t when the variable
> is used as a reference counter. This is because the implementation of
> refcount_t can prevent overflows and detect possible use-after-free.

The use of refcount_t comes at a cost:

q:/usr/src/25> size mm/rmap.o
   text    data     bss     dec     hex filename
  31114    2147      32   33293    820d mm/rmap.o
  31558    2147      32   33737    83c9 mm/rmap.o

That's a bunch more instructions to execute on some fairly hot
code paths.

I guess the debugging/checking features are nice, but this is pretty
mature code.  I'm quite unsure that this tradeoff is a favorable one.

Reply via email to