From: Muchun Song <songmuchun@bytedance.com>
To: guro@fb.com, hannes@cmpxchg.org, mhocko@kernel.org,
akpm@linux-foundation.org, shakeelb@google.com,
vdavydov.dev@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
duanxiongchun@bytedance.com, fam.zheng@bytedance.com,
bsingharora@gmail.com, shy828301@gmail.com, alexs@kernel.org,
smuchun@gmail.com, zhengqi.arch@bytedance.com,
Muchun Song <songmuchun@bytedance.com>
Subject: [PATCH v2 01/13] mm: move mem_cgroup_kmem_disabled() to memcontrol.h
Date: Thu, 16 Sep 2021 21:47:36 +0800 [thread overview]
Message-ID: <20210916134748.67712-2-songmuchun@bytedance.com> (raw)
In-Reply-To: <20210916134748.67712-1-songmuchun@bytedance.com>
The cgroup_memory_nokmem is already a global variable, it is unnecessary
to define a global function of mem_cgroup_kmem_disabled(). Just move it
to memcontrol.h and mark inline on it. slab_common.c already includes
memcontrol.h, replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled().
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
include/linux/memcontrol.h | 8 +++++++-
mm/internal.h | 5 -----
mm/memcontrol.c | 5 -----
mm/slab_common.c | 2 +-
4 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3096c9a0ee01..e194d90aff56 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1639,7 +1639,13 @@ static inline void set_shrinker_bit(struct mem_cgroup *memcg,
#endif
#ifdef CONFIG_MEMCG_KMEM
-bool mem_cgroup_kmem_disabled(void);
+extern bool cgroup_memory_nokmem;
+
+static inline bool mem_cgroup_kmem_disabled(void)
+{
+ return cgroup_memory_nokmem;
+}
+
int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order);
void __memcg_kmem_uncharge_page(struct page *page, int order);
diff --git a/mm/internal.h b/mm/internal.h
index cf3cb933eba3..649684e20fe4 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -116,11 +116,6 @@ extern void putback_lru_page(struct page *page);
extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
/*
- * in mm/memcontrol.c:
- */
-extern bool cgroup_memory_nokmem;
-
-/*
* in mm/page_alloc.c
*/
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b762215d73eb..528b134ca50c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -264,11 +264,6 @@ struct mem_cgroup *vmpressure_to_memcg(struct vmpressure *vmpr)
#ifdef CONFIG_MEMCG_KMEM
extern spinlock_t css_set_lock;
-bool mem_cgroup_kmem_disabled(void)
-{
- return cgroup_memory_nokmem;
-}
-
static void obj_cgroup_uncharge_pages(struct obj_cgroup *objcg,
unsigned int nr_pages);
diff --git a/mm/slab_common.c b/mm/slab_common.c
index ec2bb0beed75..4c0549e0f349 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -857,7 +857,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
if (type == KMALLOC_RECLAIM) {
flags |= SLAB_RECLAIM_ACCOUNT;
} else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) {
- if (cgroup_memory_nokmem) {
+ if (mem_cgroup_kmem_disabled()) {
kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx];
return;
}
--
2.11.0
next prev parent reply other threads:[~2021-09-16 13:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 13:47 [PATCH v2 00/13] Use obj_cgroup APIs to charge the LRU pages Muchun Song
2021-09-16 13:47 ` Muchun Song [this message]
2021-09-16 13:47 ` [PATCH v2 02/13] mm: memcontrol: prepare objcg API for non-kmem usage Muchun Song
2021-09-17 17:40 ` kernel test robot
2021-09-16 13:47 ` [PATCH v2 03/13] mm: memcontrol: introduce compact_lock_page_irqsave Muchun Song
2021-09-16 13:47 ` [PATCH v2 04/13] mm: memcontrol: make lruvec lock safe when the LRU pages reparented Muchun Song
2021-09-16 13:47 ` [PATCH v2 05/13] mm: vmscan: rework move_pages_to_lru() Muchun Song
2021-09-16 13:47 ` [PATCH v2 06/13] mm: thp: introduce split_queue_lock/unlock{_irqsave}() Muchun Song
2021-09-17 2:43 ` kernel test robot
2021-09-17 17:07 ` kernel test robot
2021-09-16 13:47 ` [PATCH v2 07/13] mm: thp: make split queue lock safe when LRU pages reparented Muchun Song
2021-09-17 6:38 ` kernel test robot
2021-09-16 13:47 ` [PATCH v2 08/13] mm: memcontrol: make all the callers of page_memcg() safe Muchun Song
2021-09-16 13:47 ` [PATCH v2 09/13] mm: memcontrol: introduce memcg_reparent_ops Muchun Song
2021-09-16 13:47 ` [PATCH v2 10/13] mm: memcontrol: use obj_cgroup APIs to charge the LRU pages Muchun Song
2021-09-17 16:31 ` kernel test robot
2021-09-16 13:47 ` [PATCH v2 11/13] mm: memcontrol: rename {un}lock_page_memcg() to {un}lock_page_objcg() Muchun Song
2021-09-16 13:47 ` [PATCH v2 12/13] mm: lru: add VM_BUG_ON_PAGE to lru maintenance function Muchun Song
2021-09-16 13:47 ` [PATCH v2 13/13] mm: lru: use lruvec lock to serialize memcg changes Muchun Song
2021-09-17 1:28 ` [PATCH v2 00/13] Use obj_cgroup APIs to charge the LRU pages Roman Gushchin
2021-09-17 10:49 ` Muchun Song
2021-09-18 0:13 ` Roman Gushchin
2021-09-18 7:55 ` Muchun Song
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=20210916134748.67712-2-songmuchun@bytedance.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=bsingharora@gmail.com \
--cc=duanxiongchun@bytedance.com \
--cc=fam.zheng@bytedance.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=shy828301@gmail.com \
--cc=smuchun@gmail.com \
--cc=vdavydov.dev@gmail.com \
--cc=zhengqi.arch@bytedance.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