Commit e340322a authored by Alex Shi's avatar Alex Shi Committed by Stephen Rothwell
Browse files

mm/memcg: bail early from swap accounting if memcg disabled

Patch series "bail out early for memcg disable".

These 2 patches are indepenedent from per memcg lru lock, and may
encounter unexpected warning, so let's move out them from per memcg
lru locking patchset.

This patch (of 2):

We could bail out early when memcg wasn't enabled.


Signed-off-by: default avatarAlex Shi <>
Reviewed-by: default avatarRoman Gushchin <>
Acked-by: default avatarMichal Hocko <>
Acked-by: default avatarHugh Dickins <>
Acked-by: default avatarJohannes Weiner <>
Cc: Vladimir Davydov <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarStephen Rothwell <>
parent 918151cd
......@@ -7158,6 +7158,9 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
VM_BUG_ON_PAGE(PageLRU(page), page);
VM_BUG_ON_PAGE(page_count(page), page);
if (mem_cgroup_disabled())
if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
......@@ -7222,6 +7225,9 @@ int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry)
struct mem_cgroup *memcg;
unsigned short oldid;
if (mem_cgroup_disabled())
return 0;
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
return 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment