Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84c07d11 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Linus Torvalds
Browse files

mm: introduce CONFIG_MEMCG_KMEM as combination of CONFIG_MEMCG && !CONFIG_SLOB

Introduce new config option, which is used to replace repeating
CONFIG_MEMCG && !CONFIG_SLOB pattern.  Next patches add a little more
memcg+kmem related code, so let's keep the defines more clearly.

Link: http://lkml.kernel.org/r/153063053670.1818.15013136946600481138.stgit@localhost.localdomain


Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: default avatarVladimir Davydov <vdavydov.dev@gmail.com>
Tested-by: default avatarShakeel Butt <shakeelb@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Li RongQing <lirongqing@baidu.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Sahitya Tummala <stummala@codeaurora.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e0295238
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ struct list_lru_node {
	spinlock_t		lock;
	/* global list, used for the root cgroup in cgroup aware lrus */
	struct list_lru_one	lru;
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
#ifdef CONFIG_MEMCG_KMEM
	/* for cgroup aware lrus points to per cgroup lists, otherwise NULL */
	struct list_lru_memcg	__rcu *memcg_lrus;
#endif
@@ -51,7 +51,7 @@ struct list_lru_node {

struct list_lru {
	struct list_lru_node	*node;
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
#ifdef CONFIG_MEMCG_KMEM
	struct list_head	list;
#endif
};
+3 −3
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ struct mem_cgroup {
	bool			tcpmem_active;
	int			tcpmem_pressure;

#ifndef CONFIG_SLOB
#ifdef CONFIG_MEMCG_KMEM
        /* Index in the kmem_cache->memcg_params.memcg_caches array */
	int kmemcg_id;
	enum memcg_kmem_state kmem_state;
@@ -1231,7 +1231,7 @@ int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,
int memcg_kmem_charge(struct page *page, gfp_t gfp, int order);
void memcg_kmem_uncharge(struct page *page, int order);

#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
#ifdef CONFIG_MEMCG_KMEM
extern struct static_key_false memcg_kmem_enabled_key;
extern struct workqueue_struct *memcg_kmem_cache_wq;

@@ -1284,6 +1284,6 @@ static inline void memcg_put_cache_ids(void)
{
}

#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
#endif /* CONFIG_MEMCG_KMEM */

#endif /* _LINUX_MEMCONTROL_H */
+1 −1
Original line number Diff line number Diff line
@@ -723,7 +723,7 @@ struct task_struct {
#endif
#ifdef CONFIG_MEMCG
	unsigned			in_user_fault:1;
#ifndef CONFIG_SLOB
#ifdef CONFIG_MEMCG_KMEM
	unsigned			memcg_kmem_skip_account:1;
#endif
#endif
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@
# define SLAB_FAILSLAB		0
#endif
/* Account to memcg */
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
#ifdef CONFIG_MEMCG_KMEM
# define SLAB_ACCOUNT		((slab_flags_t __force)0x04000000U)
#else
# define SLAB_ACCOUNT		0
+5 −0
Original line number Diff line number Diff line
@@ -708,6 +708,11 @@ config MEMCG_SWAP_ENABLED
	  select this option (if, for some reason, they need to disable it
	  then swapaccount=0 does the trick).

config MEMCG_KMEM
	bool
	depends on MEMCG && !SLOB
	default y

config BLK_CGROUP
	bool "IO controller"
	depends on BLOCK
Loading