Commit 0a27cae1 authored by Alex Shi's avatar Alex Shi Committed by Linus Torvalds

mm: memcontrol: document the new swap control behavior

Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Link: http://lkml.kernel.org/r/20200508183105.225460-18-hannes@cmpxchg.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4c6355b2
...@@ -199,11 +199,11 @@ An RSS page is unaccounted when it's fully unmapped. A PageCache page is ...@@ -199,11 +199,11 @@ An RSS page is unaccounted when it's fully unmapped. A PageCache page is
unaccounted when it's removed from radix-tree. Even if RSS pages are fully unaccounted when it's removed from radix-tree. Even if RSS pages are fully
unmapped (by kswapd), they may exist as SwapCache in the system until they unmapped (by kswapd), they may exist as SwapCache in the system until they
are really freed. Such SwapCaches are also accounted. are really freed. Such SwapCaches are also accounted.
A swapped-in page is not accounted until it's mapped. A swapped-in page is accounted after adding into swapcache.
Note: The kernel does swapin-readahead and reads multiple swaps at once. Note: The kernel does swapin-readahead and reads multiple swaps at once.
This means swapped-in pages may contain pages for other tasks than a task Since page's memcg recorded into swap whatever memsw enabled, the page will
causing page fault. So, we avoid accounting at swap-in I/O. be accounted after swapin.
At page migration, accounting information is kept. At page migration, accounting information is kept.
...@@ -222,18 +222,13 @@ the cgroup that brought it in -- this will happen on memory pressure). ...@@ -222,18 +222,13 @@ the cgroup that brought it in -- this will happen on memory pressure).
But see section 8.2: when moving a task to another cgroup, its pages may But see section 8.2: when moving a task to another cgroup, its pages may
be recharged to the new cgroup, if move_charge_at_immigrate has been chosen. be recharged to the new cgroup, if move_charge_at_immigrate has been chosen.
Exception: If CONFIG_MEMCG_SWAP is not used. 2.4 Swap Extension
When you do swapoff and make swapped-out pages of shmem(tmpfs) to
be backed into memory in force, charges for pages are accounted against the
caller of swapoff rather than the users of shmem.
2.4 Swap Extension (CONFIG_MEMCG_SWAP)
-------------------------------------- --------------------------------------
Swap Extension allows you to record charge for swap. A swapped-in page is Swap usage is always recorded for each of cgroup. Swap Extension allows you to
charged back to original page allocator if possible. read and limit it.
When swap is accounted, following files are added. When CONFIG_SWAP is enabled, following files are added.
- memory.memsw.usage_in_bytes. - memory.memsw.usage_in_bytes.
- memory.memsw.limit_in_bytes. - memory.memsw.limit_in_bytes.
......
Markdown is supported
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