|
| 1 | +From: Johannes Weiner < [email protected]> |
| 2 | +Subject: Documentation: filesystems: proc: update meminfo section |
| 3 | + |
| 4 | +Patch series "zswap: accounting & cgroup control", v2. |
| 5 | + |
| 6 | +Zswap can consume nearly a quarter of RAM in the default configuration, |
| 7 | +yet it's neither listed in /proc/meminfo, nor is it accounted and |
| 8 | +manageable on a per-cgroup basis. |
| 9 | + |
| 10 | +This makes reasoning about the memory situation on a host in general |
| 11 | +rather difficult. On shared/cgrouped hosts, the consequences are worse. |
| 12 | +First, workloads can escape memory containment and cause resource priority |
| 13 | +inversions: a lo-pri group can fill the global zswap pool and force a |
| 14 | +hi-pri group out to disk. Second, not all workloads benefit from zswap |
| 15 | +equally. Some even suffer when memory contents compress poorly, and are |
| 16 | +better off going to disk swap directly. On a host with mixed workloads, |
| 17 | +it's currently not possible to enable zswap for one workload but not for |
| 18 | +the other. |
| 19 | + |
| 20 | +This series implements the missing global accounting as well as cgroup |
| 21 | +tracking & control for zswap backing memory: |
| 22 | + |
| 23 | +- Patch 1 refreshes the very out-of-date meminfo documentation in |
| 24 | + Documentation/filesystems/proc.rst. |
| 25 | + |
| 26 | +- Patches 2-4 clean up related and adjacent options in Kconfig. Not |
| 27 | + actual dependencies, just things I noticed during development. |
| 28 | + |
| 29 | +- Patch 5 adds meminfo and vmstat coverage for zswap consumption and |
| 30 | + activity. |
| 31 | + |
| 32 | +- Patch 6 implements per-cgroup tracking & control of zswap memory. |
| 33 | + |
| 34 | + |
| 35 | +This patch (of 6): |
| 36 | + |
| 37 | +Add new entries. Minor corrections and cleanups. |
| 38 | + |
| 39 | +Link: https://lkml.kernel.org/r/ [email protected] |
| 40 | +Link: https://lkml.kernel.org/r/ [email protected] |
| 41 | +Signed-off-by: Johannes Weiner < [email protected]> |
| 42 | +Cc: Dan Streetman < [email protected]> |
| 43 | +Cc: Michal Hocko < [email protected]> |
| 44 | +Cc: Minchan Kim < [email protected]> |
| 45 | +Cc: Roman Gushchin < [email protected]> |
| 46 | +Cc: Seth Jennings < [email protected]> |
| 47 | +Cc: Shakeel Butt < [email protected]> |
| 48 | +Signed-off-by: Andrew Morton < [email protected]> |
| 49 | +--- |
| 50 | + |
| 51 | + Documentation/filesystems/proc.rst | 155 +++++++++++++++++---------- |
| 52 | + 1 file changed, 99 insertions(+), 56 deletions(-) |
| 53 | + |
| 54 | +--- a/Documentation/filesystems/proc.rst~documentation-filesystems-proc-update-meminfo-section |
| 55 | ++++ a/Documentation/filesystems/proc.rst |
| 56 | +@@ -942,56 +942,71 @@ can be substantial. In many cases there |
| 57 | + additional memory using subsystem specific interfaces, for instance |
| 58 | + /proc/net/sockstat for TCP memory allocations. |
| 59 | + |
| 60 | +-The following is from a 16GB PIII, which has highmem enabled. |
| 61 | +-You may not have all of these fields. |
| 62 | ++Example output. You may not have all of these fields. |
| 63 | + |
| 64 | + :: |
| 65 | + |
| 66 | + > cat /proc/meminfo |
| 67 | + |
| 68 | +- MemTotal: 16344972 kB |
| 69 | +- MemFree: 13634064 kB |
| 70 | +- MemAvailable: 14836172 kB |
| 71 | +- Buffers: 3656 kB |
| 72 | +- Cached: 1195708 kB |
| 73 | +- SwapCached: 0 kB |
| 74 | +- Active: 891636 kB |
| 75 | +- Inactive: 1077224 kB |
| 76 | +- HighTotal: 15597528 kB |
| 77 | +- HighFree: 13629632 kB |
| 78 | +- LowTotal: 747444 kB |
| 79 | +- LowFree: 4432 kB |
| 80 | +- SwapTotal: 0 kB |
| 81 | +- SwapFree: 0 kB |
| 82 | +- Dirty: 968 kB |
| 83 | +- Writeback: 0 kB |
| 84 | +- AnonPages: 861800 kB |
| 85 | +- Mapped: 280372 kB |
| 86 | +- Shmem: 644 kB |
| 87 | +- KReclaimable: 168048 kB |
| 88 | +- Slab: 284364 kB |
| 89 | +- SReclaimable: 159856 kB |
| 90 | +- SUnreclaim: 124508 kB |
| 91 | +- PageTables: 24448 kB |
| 92 | +- NFS_Unstable: 0 kB |
| 93 | +- Bounce: 0 kB |
| 94 | +- WritebackTmp: 0 kB |
| 95 | +- CommitLimit: 7669796 kB |
| 96 | +- Committed_AS: 100056 kB |
| 97 | +- VmallocTotal: 112216 kB |
| 98 | +- VmallocUsed: 428 kB |
| 99 | +- VmallocChunk: 111088 kB |
| 100 | +- Percpu: 62080 kB |
| 101 | +- HardwareCorrupted: 0 kB |
| 102 | +- AnonHugePages: 49152 kB |
| 103 | +- ShmemHugePages: 0 kB |
| 104 | +- ShmemPmdMapped: 0 kB |
| 105 | ++ MemTotal: 32858820 kB |
| 106 | ++ MemFree: 21001236 kB |
| 107 | ++ MemAvailable: 27214312 kB |
| 108 | ++ Buffers: 581092 kB |
| 109 | ++ Cached: 5587612 kB |
| 110 | ++ SwapCached: 0 kB |
| 111 | ++ Active: 3237152 kB |
| 112 | ++ Inactive: 7586256 kB |
| 113 | ++ Active(anon): 94064 kB |
| 114 | ++ Inactive(anon): 4570616 kB |
| 115 | ++ Active(file): 3143088 kB |
| 116 | ++ Inactive(file): 3015640 kB |
| 117 | ++ Unevictable: 0 kB |
| 118 | ++ Mlocked: 0 kB |
| 119 | ++ SwapTotal: 0 kB |
| 120 | ++ SwapFree: 0 kB |
| 121 | ++ Dirty: 12 kB |
| 122 | ++ Writeback: 0 kB |
| 123 | ++ AnonPages: 4654780 kB |
| 124 | ++ Mapped: 266244 kB |
| 125 | ++ Shmem: 9976 kB |
| 126 | ++ KReclaimable: 517708 kB |
| 127 | ++ Slab: 660044 kB |
| 128 | ++ SReclaimable: 517708 kB |
| 129 | ++ SUnreclaim: 142336 kB |
| 130 | ++ KernelStack: 11168 kB |
| 131 | ++ PageTables: 20540 kB |
| 132 | ++ NFS_Unstable: 0 kB |
| 133 | ++ Bounce: 0 kB |
| 134 | ++ WritebackTmp: 0 kB |
| 135 | ++ CommitLimit: 16429408 kB |
| 136 | ++ Committed_AS: 7715148 kB |
| 137 | ++ VmallocTotal: 34359738367 kB |
| 138 | ++ VmallocUsed: 40444 kB |
| 139 | ++ VmallocChunk: 0 kB |
| 140 | ++ Percpu: 29312 kB |
| 141 | ++ HardwareCorrupted: 0 kB |
| 142 | ++ AnonHugePages: 4149248 kB |
| 143 | ++ ShmemHugePages: 0 kB |
| 144 | ++ ShmemPmdMapped: 0 kB |
| 145 | ++ FileHugePages: 0 kB |
| 146 | ++ FilePmdMapped: 0 kB |
| 147 | ++ CmaTotal: 0 kB |
| 148 | ++ CmaFree: 0 kB |
| 149 | ++ HugePages_Total: 0 |
| 150 | ++ HugePages_Free: 0 |
| 151 | ++ HugePages_Rsvd: 0 |
| 152 | ++ HugePages_Surp: 0 |
| 153 | ++ Hugepagesize: 2048 kB |
| 154 | ++ Hugetlb: 0 kB |
| 155 | ++ DirectMap4k: 401152 kB |
| 156 | ++ DirectMap2M: 10008576 kB |
| 157 | ++ DirectMap1G: 24117248 kB |
| 158 | + |
| 159 | + MemTotal |
| 160 | + Total usable RAM (i.e. physical RAM minus a few reserved |
| 161 | + bits and the kernel binary code) |
| 162 | + MemFree |
| 163 | +- The sum of LowFree+HighFree |
| 164 | ++ Total free RAM. On highmem systems, the sum of LowFree+HighFree |
| 165 | + MemAvailable |
| 166 | + An estimate of how much memory is available for starting new |
| 167 | + applications, without swapping. Calculated from MemFree, |
| 168 | +@@ -1005,8 +1020,9 @@ Buffers |
| 169 | + Relatively temporary storage for raw disk blocks |
| 170 | + shouldn't get tremendously large (20MB or so) |
| 171 | + Cached |
| 172 | +- in-memory cache for files read from the disk (the |
| 173 | +- pagecache). Doesn't include SwapCached |
| 174 | ++ In-memory cache for files read from the disk (the |
| 175 | ++ pagecache) as well as tmpfs & shmem. |
| 176 | ++ Doesn't include SwapCached. |
| 177 | + SwapCached |
| 178 | + Memory that once was swapped out, is swapped back in but |
| 179 | + still also is in the swapfile (if memory is needed it |
| 180 | +@@ -1018,6 +1034,11 @@ Active |
| 181 | + Inactive |
| 182 | + Memory which has been less recently used. It is more |
| 183 | + eligible to be reclaimed for other purposes |
| 184 | ++Unevictable |
| 185 | ++ Memory that cannot be reclaimed, such as mlocked pages, |
| 186 | ++ ramfs backing pages, secret memfd pages etc. |
| 187 | ++Mlocked |
| 188 | ++ Memory locked with mlock(). |
| 189 | + HighTotal, HighFree |
| 190 | + Highmem is all memory above ~860MB of physical memory. |
| 191 | + Highmem areas are for use by userspace programs, or |
| 192 | +@@ -1040,20 +1061,10 @@ Writeback |
| 193 | + Memory which is actively being written back to the disk |
| 194 | + AnonPages |
| 195 | + Non-file backed pages mapped into userspace page tables |
| 196 | +-HardwareCorrupted |
| 197 | +- The amount of RAM/memory in KB, the kernel identifies as |
| 198 | +- corrupted. |
| 199 | +-AnonHugePages |
| 200 | +- Non-file backed huge pages mapped into userspace page tables |
| 201 | + Mapped |
| 202 | + files which have been mmaped, such as libraries |
| 203 | + Shmem |
| 204 | + Total memory used by shared memory (shmem) and tmpfs |
| 205 | +-ShmemHugePages |
| 206 | +- Memory used by shared memory (shmem) and tmpfs allocated |
| 207 | +- with huge pages |
| 208 | +-ShmemPmdMapped |
| 209 | +- Shared memory mapped into userspace with huge pages |
| 210 | + KReclaimable |
| 211 | + Kernel allocations that the kernel will attempt to reclaim |
| 212 | + under memory pressure. Includes SReclaimable (below), and other |
| 213 | +@@ -1064,9 +1075,10 @@ SReclaimable |
| 214 | + Part of Slab, that might be reclaimed, such as caches |
| 215 | + SUnreclaim |
| 216 | + Part of Slab, that cannot be reclaimed on memory pressure |
| 217 | ++KernelStack |
| 218 | ++ Memory consumed by the kernel stacks of all tasks |
| 219 | + PageTables |
| 220 | +- amount of memory dedicated to the lowest level of page |
| 221 | +- tables. |
| 222 | ++ Memory consumed by userspace page tables |
| 223 | + NFS_Unstable |
| 224 | + Always zero. Previous counted pages which had been written to |
| 225 | + the server, but has not been committed to stable storage. |
| 226 | +@@ -1098,7 +1110,7 @@ Committed_AS |
| 227 | + has been allocated by processes, even if it has not been |
| 228 | + "used" by them as of yet. A process which malloc()'s 1G |
| 229 | + of memory, but only touches 300M of it will show up as |
| 230 | +- using 1G. This 1G is memory which has been "committed" to |
| 231 | ++ using 1G. This 1G is memory which has been "committed" to |
| 232 | + by the VM and can be used at any time by the allocating |
| 233 | + application. With strict overcommit enabled on the system |
| 234 | + (mode 2 in 'vm.overcommit_memory'), allocations which would |
| 235 | +@@ -1107,7 +1119,7 @@ Committed_AS |
| 236 | + not fail due to lack of memory once that memory has been |
| 237 | + successfully allocated. |
| 238 | + VmallocTotal |
| 239 | +- total size of vmalloc memory area |
| 240 | ++ total size of vmalloc virtual address space |
| 241 | + VmallocUsed |
| 242 | + amount of vmalloc area which is used |
| 243 | + VmallocChunk |
| 244 | +@@ -1115,6 +1127,37 @@ VmallocChunk |
| 245 | + Percpu |
| 246 | + Memory allocated to the percpu allocator used to back percpu |
| 247 | + allocations. This stat excludes the cost of metadata. |
| 248 | ++HardwareCorrupted |
| 249 | ++ The amount of RAM/memory in KB, the kernel identifies as |
| 250 | ++ corrupted. |
| 251 | ++AnonHugePages |
| 252 | ++ Non-file backed huge pages mapped into userspace page tables |
| 253 | ++ShmemHugePages |
| 254 | ++ Memory used by shared memory (shmem) and tmpfs allocated |
| 255 | ++ with huge pages |
| 256 | ++ShmemPmdMapped |
| 257 | ++ Shared memory mapped into userspace with huge pages |
| 258 | ++FileHugePages |
| 259 | ++ Memory used for filesystem data (page cache) allocated |
| 260 | ++ with huge pages |
| 261 | ++FilePmdMapped |
| 262 | ++ Page cache mapped into userspace with huge pages |
| 263 | ++CmaTotal |
| 264 | ++ Memory reserved for the Contiguous Memory Allocator (CMA) |
| 265 | ++CmaFree |
| 266 | ++ Free remaining memory in the CMA reserves |
| 267 | ++HugePages_Total |
| 268 | ++HugePages_Free |
| 269 | ++HugePages_Rsvd |
| 270 | ++HugePages_Surp |
| 271 | ++Hugepagesize |
| 272 | ++Hugetlb |
| 273 | ++ See Documentation/admin-guide/mm/hugetlbpage.rst. |
| 274 | ++DirectMap4k |
| 275 | ++DirectMap2M |
| 276 | ++DirectMap1G |
| 277 | ++ Breakdown of page table sizes used in the kernel's |
| 278 | ++ identity mapping of RAM |
| 279 | + |
| 280 | + vmallocinfo |
| 281 | + ~~~~~~~~~~~ |
| 282 | +_ |
0 commit comments