mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
mm: memcontrol: introduce CONFIG_MEMCG_LEGACY_KMEM
Let the user know that CONFIG_MEMCG_KMEM does not apply to the cgroup2 interface. This also makes legacy-only code sections stand out better. [[email protected]: mm: memcontrol: only manage socket pressure for CONFIG_INET] Signed-off-by: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Tejun Heo <[email protected]> Acked-by: Vladimir Davydov <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
04823c833b
commit
489c2a20a4
5 changed files with 23 additions and 13 deletions
|
|
@ -3001,7 +3001,7 @@ static void memcg_free_kmem(struct mem_cgroup *memcg)
|
|||
}
|
||||
#endif /* !CONFIG_SLOB */
|
||||
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
static int memcg_update_kmem_limit(struct mem_cgroup *memcg,
|
||||
unsigned long limit)
|
||||
{
|
||||
|
|
@ -3025,7 +3025,7 @@ static int memcg_update_kmem_limit(struct mem_cgroup *memcg,
|
|||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif /* CONFIG_MEMCG_KMEM */
|
||||
#endif /* CONFIG_MEMCG_LEGACY_KMEM */
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -4039,7 +4039,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
|
|||
.seq_show = memcg_numa_stat_show,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
{
|
||||
.name = "kmem.limit_in_bytes",
|
||||
.private = MEMFILE_PRIVATE(_KMEM, RES_LIMIT),
|
||||
|
|
@ -4266,13 +4266,13 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_INET
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
ret = tcp_init_cgroup(memcg);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INET
|
||||
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
|
||||
static_branch_inc(&memcg_sockets_enabled_key);
|
||||
#endif
|
||||
|
|
@ -4329,7 +4329,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
|
|||
|
||||
memcg_free_kmem(memcg);
|
||||
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#if defined(CONFIG_MEMCG_LEGACY_KMEM) && defined(CONFIG_INET)
|
||||
tcp_destroy_cgroup(memcg);
|
||||
#endif
|
||||
|
||||
|
|
@ -5558,7 +5558,7 @@ void sock_update_memcg(struct sock *sk)
|
|||
memcg = mem_cgroup_from_task(current);
|
||||
if (memcg == root_mem_cgroup)
|
||||
goto out;
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && !memcg->tcp_mem.active)
|
||||
goto out;
|
||||
#endif
|
||||
|
|
@ -5587,7 +5587,7 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages)
|
|||
{
|
||||
gfp_t gfp_mask = GFP_KERNEL;
|
||||
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) {
|
||||
struct page_counter *counter;
|
||||
|
||||
|
|
@ -5619,7 +5619,7 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages)
|
|||
*/
|
||||
void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages)
|
||||
{
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG_LEGACY_KMEM
|
||||
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) {
|
||||
page_counter_uncharge(&memcg->tcp_mem.memory_allocated,
|
||||
nr_pages);
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
|
|||
|
||||
level = vmpressure_calc_level(scanned, reclaimed);
|
||||
|
||||
#ifdef CONFIG_INET
|
||||
if (level > VMPRESSURE_LOW) {
|
||||
/*
|
||||
* Let the socket buffer allocator know that
|
||||
|
|
@ -286,6 +287,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
|
|||
*/
|
||||
memcg->socket_pressure = jiffies + HZ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue