[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210311135731.b0ce4c346aa8ade64fb9b5fc@linux-foundation.org>
Date: Thu, 11 Mar 2021 13:57:31 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yejune Deng <yejune.deng@...il.com>
Cc: walken@...gle.com, hannes@...xchg.org, louhongxiang@...wei.com,
linmiaohe@...wei.com, shakeelb@...gle.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm/rmap: convert anon_vma.refcount from atomic_t to
refcount_t
On Thu, 11 Mar 2021 13:56:15 +0800 Yejune Deng <yejune.deng@...il.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.
Powered by blists - more mailing lists