From: Roman Gushchin <guro@fb.com>
To: 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>,
Vlastimil Babka <vbabka@suse.cz>, <kernel-team@fb.com>,
<linux-kernel@vger.kernel.org>, Roman Gushchin <guro@fb.com>
Subject: [PATCH 3/3] mm: kmem: switch to static_branch_likely() in memcg_kmem_enabled()
Date: Tue, 7 Jul 2020 10:36:12 -0700 [thread overview]
Message-ID: <20200707173612.124425-3-guro@fb.com> (raw)
In-Reply-To: <20200707173612.124425-1-guro@fb.com>
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>
---
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)
--
2.26.2
next prev parent reply other threads:[~2020-07-07 17:36 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 ` Roman Gushchin [this message]
2020-07-07 17:52 ` [PATCH 3/3] mm: kmem: switch to static_branch_likely() in memcg_kmem_enabled() Shakeel Butt
2020-07-08 11:17 ` Vlastimil Babka
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=20200707173612.124425-3-guro@fb.com \
--to=guro@fb.com \
--cc=akpm@linux-foundation.org \
--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 \
--cc=vbabka@suse.cz \
/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).