linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>
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 v5 11/19] mm: memcg/slab: move memcg_kmem_bypass() to memcontrol.h
Date: Wed, 27 May 2020 15:33:56 -0700	[thread overview]
Message-ID: <20200527223404.1008856-12-guro@fb.com> (raw)
In-Reply-To: <20200527223404.1008856-1-guro@fb.com>

To make the memcg_kmem_bypass() function available outside of
the memcontrol.c, let's move it to memcontrol.h. The function
is small and nicely fits into static inline sort of functions.

It will be used from the slab code.

Signed-off-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/memcontrol.h | 7 +++++++
 mm/memcontrol.c            | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 98239fdf9fee..2165470a2534 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1442,6 +1442,13 @@ static inline bool memcg_kmem_enabled(void)
 	return static_branch_unlikely(&memcg_kmem_enabled_key);
 }
 
+static inline bool memcg_kmem_bypass(void)
+{
+	if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
+		return true;
+	return false;
+}
+
 static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
 					 int order)
 {
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 56588677608e..314084e2e6e7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2893,13 +2893,6 @@ static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
 	queue_work(memcg_kmem_cache_wq, &cw->work);
 }
 
-static inline bool memcg_kmem_bypass(void)
-{
-	if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
-		return true;
-	return false;
-}
-
 /**
  * memcg_kmem_get_cache: select the correct per-memcg cache for allocation
  * @cachep: the original global kmem cache
-- 
2.25.4



  parent reply	other threads:[~2020-05-27 22:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 22:33 [PATCH v5 00/19] The new cgroup slab memory controller Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 01/19] mm: memcg: factor out memcg- and lruvec-level changes out of __mod_lruvec_state() Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 02/19] mm: memcg: prepare for byte-sized vmstat items Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 03/19] mm: memcg: convert vmstat slab counters to bytes Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 04/19] mm: slub: implement SLUB version of obj_to_index() Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 05/19] mm: memcontrol: decouple reference counting from page accounting Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 06/19] mm: memcg/slab: obj_cgroup API Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 07/19] mm: memcg/slab: allocate obj_cgroups for non-root slab pages Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 08/19] mm: memcg/slab: save obj_cgroup for non-root slab objects Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 09/19] mm: memcg/slab: charge individual slab objects instead of pages Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 10/19] mm: memcg/slab: deprecate memory.kmem.slabinfo Roman Gushchin
2020-05-27 22:33 ` Roman Gushchin [this message]
2020-05-27 22:33 ` [PATCH v5 12/19] mm: memcg/slab: use a single set of kmem_caches for all accounted allocations Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 13/19] mm: memcg/slab: simplify memcg cache creation Roman Gushchin
2020-05-27 22:33 ` [PATCH v5 14/19] mm: memcg/slab: remove memcg_kmem_get_cache() Roman Gushchin
2020-05-27 22:34 ` [PATCH v5 15/19] mm: memcg/slab: deprecate slab_root_caches Roman Gushchin
2020-05-27 22:34 ` [PATCH v5 16/19] mm: memcg/slab: remove redundant check in memcg_accumulate_slabinfo() Roman Gushchin
2020-05-27 22:34 ` [PATCH v5 17/19] mm: memcg/slab: use a single set of kmem_caches for all allocations Roman Gushchin
2020-06-05 16:24   ` Vlastimil Babka
2020-06-05 18:17     ` Roman Gushchin
2020-05-27 22:34 ` [PATCH v5 18/19] kselftests: cgroup: add kernel memory accounting tests Roman Gushchin
2020-05-27 22:34 ` [PATCH v5 19/19] tools/cgroup: add memcg_slabinfo.py tool Roman Gushchin

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=20200527223404.1008856-12-guro@fb.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.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 \
    --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).