From: Andrew Morton <akpm@linux-foundation.org>
To: Yejune Deng <yejune.deng@gmail.com>
Cc: walken@google.com, hannes@cmpxchg.org, louhongxiang@huawei.com,
linmiaohe@huawei.com, shakeelb@google.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/rmap: convert anon_vma.refcount from atomic_t to refcount_t
Date: Thu, 11 Mar 2021 13:57:31 -0800 [thread overview]
Message-ID: <20210311135731.b0ce4c346aa8ade64fb9b5fc@linux-foundation.org> (raw)
In-Reply-To: <20210311055615.4461-1-yejune.deng@gmail.com>
On Thu, 11 Mar 2021 13:56:15 +0800 Yejune Deng <yejune.deng@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.
prev parent reply other threads:[~2021-03-11 21:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 5:56 Yejune Deng
2021-03-11 21:57 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210311135731.b0ce4c346aa8ade64fb9b5fc@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=louhongxiang@huawei.com \
--cc=shakeelb@google.com \
--cc=walken@google.com \
--cc=yejune.deng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox