]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mm: memcg/slab: move memcg_kmem_bypass() to memcontrol.h
authorRoman Gushchin <guro@fb.com>
Fri, 7 Aug 2020 06:21:06 +0000 (23:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 Aug 2020 18:33:24 +0000 (11:33 -0700)
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/20200623174037.3951353-12-guro@fb.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/memcontrol.h
mm/memcontrol.c

index b845e908e76e3c12b9bd54bb251a760e202815e1..83e2858aecf251afb45394120dec6a96e58f65b2 100644 (file)
@@ -1440,6 +1440,18 @@ 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())
+               return true;
+
+       /* Allow remote memcg charging in kthread contexts. */
+       if ((!current->mm || (current->flags & PF_KTHREAD)) &&
+            !current->active_memcg)
+               return true;
+       return false;
+}
+
 static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
                                         int order)
 {
index 0356e05bc6e6fe71d8cf4054c0ac2bd0c5869d88..5cb2a588cc107820551b23126850442719366337 100644 (file)
@@ -2945,18 +2945,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())
-               return true;
-
-       /* Allow remote memcg charging in kthread contexts. */
-       if ((!current->mm || (current->flags & PF_KTHREAD)) &&
-            !current->active_memcg)
-               return true;
-       return false;
-}
-
 /**
  * memcg_kmem_get_cache: select the correct per-memcg cache for allocation
  * @cachep: the original global kmem cache