From: Vlastimil Babka <vbabka@suse.cz>
To: Roman Gushchin <guro@fb.com>, Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Shakeel Butt <shakeelb@google.com>,
linux-mm@kvack.org, kernel-team@fb.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm: kmem: switch to static_branch_likely() in memcg_kmem_enabled()
Date: Wed, 8 Jul 2020 13:17:09 +0200 [thread overview]
Message-ID: <302e96c9-01ba-cdf3-1f50-8d33572d6ba4@suse.cz> (raw)
In-Reply-To: <20200707173612.124425-3-guro@fb.com>
On 7/7/20 7:36 PM, Roman Gushchin wrote:
> Currently memcg_kmem_enabled() is optimized for the kernel memory
> accounting being off. It was so for a long time, and arguably the
> reason behind was that the kernel memory accounting was initially an
> opt-in feature. However, now it's on by default on both cgroup v1
> and cgroup v2, and it's on for all cgroups. So let's switch over
> to static_branch_likely() to reflect this fact.
>
> Unlikely there is a significant performance difference, as the cost
> of a memory allocation and its accounting significantly exceeds the
> cost of a jump. However, the conversion makes the code look more
> logically.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> include/linux/memcontrol.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index b8f52a3fed90..ab9322215b2e 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -1456,7 +1456,7 @@ void memcg_put_cache_ids(void);
>
> static inline bool memcg_kmem_enabled(void)
> {
> - return static_branch_unlikely(&memcg_kmem_enabled_key);
> + return static_branch_likely(&memcg_kmem_enabled_key);
> }
>
> static inline bool memcg_kmem_bypass(void)
>
next prev parent reply other threads:[~2020-07-08 11:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 17:36 [PATCH 1/3] mm: memcg/slab: remove unused argument by charge_slab_page() Roman Gushchin
2020-07-07 17:36 ` [PATCH 2/3] mm: slab: rename (un)charge_slab_page() to (un)account_slab_page() Roman Gushchin
2020-07-07 17:51 ` Shakeel Butt
2020-07-08 11:16 ` Vlastimil Babka
2020-07-07 17:36 ` [PATCH 3/3] mm: kmem: switch to static_branch_likely() in memcg_kmem_enabled() Roman Gushchin
2020-07-07 17:52 ` Shakeel Butt
2020-07-08 11:17 ` Vlastimil Babka [this message]
2020-07-07 17:50 ` [PATCH 1/3] mm: memcg/slab: remove unused argument by charge_slab_page() Shakeel Butt
2020-07-08 11:16 ` Vlastimil Babka
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=302e96c9-01ba-cdf3-1f50-8d33572d6ba4@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.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;
as well as URLs for NNTP newsgroup(s).