Skip to content

memcg: disable swap cgroup allocation at swapon

Jeff Liu cgroups linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest6 patches 26 repliesIn review

Changes in v2 from the cover letter

- Refactor swap_cgroup_swapon()/swap_cgroup_prepare(), to make the later can be used for allocating buffers per the first non-root memcg creation.
- Bypass root memcg swap statistics, using the global stats to figure it out instead.
- Export nr_swap_files which would be used when creating/freeing swap_cgroup
- Deallocate swap accounting structures on the last non-root memcg removal

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6memcg: refactor swap_cgroup_swapon()mm/page_cgroup.c+6 -112 replies
2/6memcg: bypass swap accounting for the root memcgmm/memcontrol.c+30 -56 replies
3/6memcg: introduce memsw_accounting_usersmm/page_cgroup.c+15 -15 replies
4/6memcg: export nr_swap_filesinclude/linux/swap.h mm/swapfile.c+2 -13 replies
5/6memcg: introduce swap_cgroup_init()/swap_cgroup_free()include/linux/page_cgroup.h mm/page_cgroup.c+110 -105 replies
6/6memcg: init/free swap cgroup strucutres upon create/free child memcgmm/memcontrol.c+3 -03 replies

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchGlauber CostaMichal Hocko
1/6A-b
2/6
3/6
4/6A-b A-b
5/6R-b
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] memcg: disable swap cgroup allocation at swapon

Hello,

Here is the v2 patch set for disabling swap_cgroup structures allocation per swapon.

In the initial version, one big issue is that I have missed the swap tracking for the root memcg, thanks Michal pointing it out. :)

In order to solve it, the easiest approach I can think out is to bypass the root memcg swap accounting during the business and figure it out with some global stats, which means that we always return 0 per root memcg swap charge/uncharge stage, and this is inspired by another proposal from Zhengju:
"memcg: Don't account root memcg page statistics -- https://lkml.org/lkml/2013/1/2/71"

Besides that, another major fix is deallocate swap accounting structures on the last non-root memcg remove after all references to it are gone rather than doing it on mem_cgroup_destroy().

Any comment are welcome!

v1->v2:
- Refactor swap_cgroup_swapon()/swap_cgroup_prepare(), to make the later can be used for allocating buffers per the first non-root memcg creation.
- Bypass root memcg swap statistics, using the global stats to figure it out instead.
- Export nr_swap_files which would be used when creating/freeing swap_cgroup
- Deallocate swap accounting structures on the last non-root memcg removal

Old patch set:
v1:
http://marc.info/?l=linux-mm&m=135461016823964&w=2

Thanks,
-Jeff

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>