diff options
| -rw-r--r-- | Documentation/ABI/testing/sysfs-kernel-slab | 109 | ||||
| -rw-r--r-- | mm/slub.c | 18 |
2 files changed, 75 insertions, 52 deletions
diff --git a/Documentation/ABI/testing/sysfs-kernel-slab b/Documentation/ABI/testing/sysfs-kernel-slab index 6dcf75e594fb..8b093f8222d3 100644 --- a/Documentation/ABI/testing/sysfs-kernel-slab +++ b/Documentation/ABI/testing/sysfs-kernel-slab | |||
| @@ -45,8 +45,9 @@ KernelVersion: 2.6.25 | |||
| 45 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 45 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 46 | Christoph Lameter <cl@linux-foundation.org> | 46 | Christoph Lameter <cl@linux-foundation.org> |
| 47 | Description: | 47 | Description: |
| 48 | The alloc_fastpath file is read-only and specifies how many | 48 | The alloc_fastpath file shows how many objects have been |
| 49 | objects have been allocated using the fast path. | 49 | allocated using the fast path. It can be written to clear the |
| 50 | current count. | ||
| 50 | Available when CONFIG_SLUB_STATS is enabled. | 51 | Available when CONFIG_SLUB_STATS is enabled. |
| 51 | 52 | ||
| 52 | What: /sys/kernel/slab/cache/alloc_from_partial | 53 | What: /sys/kernel/slab/cache/alloc_from_partial |
| @@ -55,9 +56,10 @@ KernelVersion: 2.6.25 | |||
| 55 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 56 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 56 | Christoph Lameter <cl@linux-foundation.org> | 57 | Christoph Lameter <cl@linux-foundation.org> |
| 57 | Description: | 58 | Description: |
| 58 | The alloc_from_partial file is read-only and specifies how | 59 | The alloc_from_partial file shows how many times a cpu slab has |
| 59 | many times a cpu slab has been full and it has been refilled | 60 | been full and it has been refilled by using a slab from the list |
| 60 | by using a slab from the list of partially used slabs. | 61 | of partially used slabs. It can be written to clear the current |
| 62 | count. | ||
| 61 | Available when CONFIG_SLUB_STATS is enabled. | 63 | Available when CONFIG_SLUB_STATS is enabled. |
| 62 | 64 | ||
| 63 | What: /sys/kernel/slab/cache/alloc_refill | 65 | What: /sys/kernel/slab/cache/alloc_refill |
| @@ -66,9 +68,9 @@ KernelVersion: 2.6.25 | |||
| 66 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 68 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 67 | Christoph Lameter <cl@linux-foundation.org> | 69 | Christoph Lameter <cl@linux-foundation.org> |
| 68 | Description: | 70 | Description: |
| 69 | The alloc_refill file is read-only and specifies how many | 71 | The alloc_refill file shows how many times the per-cpu freelist |
| 70 | times the per-cpu freelist was empty but there were objects | 72 | was empty but there were objects available as the result of |
| 71 | available as the result of remote cpu frees. | 73 | remote cpu frees. It can be written to clear the current count. |
| 72 | Available when CONFIG_SLUB_STATS is enabled. | 74 | Available when CONFIG_SLUB_STATS is enabled. |
| 73 | 75 | ||
| 74 | What: /sys/kernel/slab/cache/alloc_slab | 76 | What: /sys/kernel/slab/cache/alloc_slab |
| @@ -77,8 +79,9 @@ KernelVersion: 2.6.25 | |||
| 77 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 79 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 78 | Christoph Lameter <cl@linux-foundation.org> | 80 | Christoph Lameter <cl@linux-foundation.org> |
| 79 | Description: | 81 | Description: |
| 80 | The alloc_slab file is read-only and specifies how many times | 82 | The alloc_slab file is shows how many times a new slab had to |
| 81 | a new slab had to be allocated from the page allocator. | 83 | be allocated from the page allocator. It can be written to |
| 84 | clear the current count. | ||
| 82 | Available when CONFIG_SLUB_STATS is enabled. | 85 | Available when CONFIG_SLUB_STATS is enabled. |
| 83 | 86 | ||
| 84 | What: /sys/kernel/slab/cache/alloc_slowpath | 87 | What: /sys/kernel/slab/cache/alloc_slowpath |
| @@ -87,9 +90,10 @@ KernelVersion: 2.6.25 | |||
| 87 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 90 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 88 | Christoph Lameter <cl@linux-foundation.org> | 91 | Christoph Lameter <cl@linux-foundation.org> |
| 89 | Description: | 92 | Description: |
| 90 | The alloc_slowpath file is read-only and specifies how many | 93 | The alloc_slowpath file shows how many objects have been |
| 91 | objects have been allocated using the slow path because of a | 94 | allocated using the slow path because of a refill or |
| 92 | refill or allocation from a partial or new slab. | 95 | allocation from a partial or new slab. It can be written to |
| 96 | clear the current count. | ||
| 93 | Available when CONFIG_SLUB_STATS is enabled. | 97 | Available when CONFIG_SLUB_STATS is enabled. |
| 94 | 98 | ||
| 95 | What: /sys/kernel/slab/cache/cache_dma | 99 | What: /sys/kernel/slab/cache/cache_dma |
| @@ -117,10 +121,11 @@ KernelVersion: 2.6.31 | |||
| 117 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 121 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 118 | Christoph Lameter <cl@linux-foundation.org> | 122 | Christoph Lameter <cl@linux-foundation.org> |
| 119 | Description: | 123 | Description: |
| 120 | The file cpuslab_flush is read-only and specifies how many | 124 | The file cpuslab_flush shows how many times a cache's cpu slabs |
| 121 | times a cache's cpu slabs have been flushed as the result of | 125 | have been flushed as the result of destroying or shrinking a |
| 122 | destroying or shrinking a cache, a cpu going offline, or as | 126 | cache, a cpu going offline, or as the result of forcing an |
| 123 | the result of forcing an allocation from a certain node. | 127 | allocation from a certain node. It can be written to clear the |
| 128 | current count. | ||
| 124 | Available when CONFIG_SLUB_STATS is enabled. | 129 | Available when CONFIG_SLUB_STATS is enabled. |
| 125 | 130 | ||
| 126 | What: /sys/kernel/slab/cache/ctor | 131 | What: /sys/kernel/slab/cache/ctor |
| @@ -139,8 +144,8 @@ KernelVersion: 2.6.25 | |||
| 139 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 144 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 140 | Christoph Lameter <cl@linux-foundation.org> | 145 | Christoph Lameter <cl@linux-foundation.org> |
| 141 | Description: | 146 | Description: |
| 142 | The file deactivate_empty is read-only and specifies how many | 147 | The deactivate_empty file shows how many times an empty cpu slab |
| 143 | times an empty cpu slab was deactivated. | 148 | was deactivated. It can be written to clear the current count. |
| 144 | Available when CONFIG_SLUB_STATS is enabled. | 149 | Available when CONFIG_SLUB_STATS is enabled. |
| 145 | 150 | ||
| 146 | What: /sys/kernel/slab/cache/deactivate_full | 151 | What: /sys/kernel/slab/cache/deactivate_full |
| @@ -149,8 +154,8 @@ KernelVersion: 2.6.25 | |||
| 149 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 154 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 150 | Christoph Lameter <cl@linux-foundation.org> | 155 | Christoph Lameter <cl@linux-foundation.org> |
| 151 | Description: | 156 | Description: |
| 152 | The file deactivate_full is read-only and specifies how many | 157 | The deactivate_full file shows how many times a full cpu slab |
| 153 | times a full cpu slab was deactivated. | 158 | was deactivated. It can be written to clear the current count. |
| 154 | Available when CONFIG_SLUB_STATS is enabled. | 159 | Available when CONFIG_SLUB_STATS is enabled. |
| 155 | 160 | ||
| 156 | What: /sys/kernel/slab/cache/deactivate_remote_frees | 161 | What: /sys/kernel/slab/cache/deactivate_remote_frees |
| @@ -159,9 +164,9 @@ KernelVersion: 2.6.25 | |||
| 159 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 164 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 160 | Christoph Lameter <cl@linux-foundation.org> | 165 | Christoph Lameter <cl@linux-foundation.org> |
| 161 | Description: | 166 | Description: |
| 162 | The file deactivate_remote_frees is read-only and specifies how | 167 | The deactivate_remote_frees file shows how many times a cpu slab |
| 163 | many times a cpu slab has been deactivated and contained free | 168 | has been deactivated and contained free objects that were freed |
| 164 | objects that were freed remotely. | 169 | remotely. It can be written to clear the current count. |
| 165 | Available when CONFIG_SLUB_STATS is enabled. | 170 | Available when CONFIG_SLUB_STATS is enabled. |
| 166 | 171 | ||
| 167 | What: /sys/kernel/slab/cache/deactivate_to_head | 172 | What: /sys/kernel/slab/cache/deactivate_to_head |
| @@ -170,9 +175,9 @@ KernelVersion: 2.6.25 | |||
| 170 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 175 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 171 | Christoph Lameter <cl@linux-foundation.org> | 176 | Christoph Lameter <cl@linux-foundation.org> |
| 172 | Description: | 177 | Description: |
| 173 | The file deactivate_to_head is read-only and specifies how | 178 | The deactivate_to_head file shows how many times a partial cpu |
| 174 | many times a partial cpu slab was deactivated and added to the | 179 | slab was deactivated and added to the head of its node's partial |
| 175 | head of its node's partial list. | 180 | list. It can be written to clear the current count. |
| 176 | Available when CONFIG_SLUB_STATS is enabled. | 181 | Available when CONFIG_SLUB_STATS is enabled. |
| 177 | 182 | ||
| 178 | What: /sys/kernel/slab/cache/deactivate_to_tail | 183 | What: /sys/kernel/slab/cache/deactivate_to_tail |
| @@ -181,9 +186,9 @@ KernelVersion: 2.6.25 | |||
| 181 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 186 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 182 | Christoph Lameter <cl@linux-foundation.org> | 187 | Christoph Lameter <cl@linux-foundation.org> |
| 183 | Description: | 188 | Description: |
| 184 | The file deactivate_to_tail is read-only and specifies how | 189 | The deactivate_to_tail file shows how many times a partial cpu |
| 185 | many times a partial cpu slab was deactivated and added to the | 190 | slab was deactivated and added to the tail of its node's partial |
| 186 | tail of its node's partial list. | 191 | list. It can be written to clear the current count. |
| 187 | Available when CONFIG_SLUB_STATS is enabled. | 192 | Available when CONFIG_SLUB_STATS is enabled. |
| 188 | 193 | ||
| 189 | What: /sys/kernel/slab/cache/destroy_by_rcu | 194 | What: /sys/kernel/slab/cache/destroy_by_rcu |
| @@ -201,9 +206,9 @@ KernelVersion: 2.6.25 | |||
| 201 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 206 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 202 | Christoph Lameter <cl@linux-foundation.org> | 207 | Christoph Lameter <cl@linux-foundation.org> |
| 203 | Description: | 208 | Description: |
| 204 | The file free_add_partial is read-only and specifies how many | 209 | The free_add_partial file shows how many times an object has |
| 205 | times an object has been freed in a full slab so that it had to | 210 | been freed in a full slab so that it had to added to its node's |
| 206 | added to its node's partial list. | 211 | partial list. It can be written to clear the current count. |
| 207 | Available when CONFIG_SLUB_STATS is enabled. | 212 | Available when CONFIG_SLUB_STATS is enabled. |
| 208 | 213 | ||
| 209 | What: /sys/kernel/slab/cache/free_calls | 214 | What: /sys/kernel/slab/cache/free_calls |
| @@ -222,9 +227,9 @@ KernelVersion: 2.6.25 | |||
| 222 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 227 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 223 | Christoph Lameter <cl@linux-foundation.org> | 228 | Christoph Lameter <cl@linux-foundation.org> |
| 224 | Description: | 229 | Description: |
| 225 | The free_fastpath file is read-only and specifies how many | 230 | The free_fastpath file shows how many objects have been freed |
| 226 | objects have been freed using the fast path because it was an | 231 | using the fast path because it was an object from the cpu slab. |
| 227 | object from the cpu slab. | 232 | It can be written to clear the current count. |
| 228 | Available when CONFIG_SLUB_STATS is enabled. | 233 | Available when CONFIG_SLUB_STATS is enabled. |
| 229 | 234 | ||
| 230 | What: /sys/kernel/slab/cache/free_frozen | 235 | What: /sys/kernel/slab/cache/free_frozen |
| @@ -233,9 +238,9 @@ KernelVersion: 2.6.25 | |||
| 233 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 238 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 234 | Christoph Lameter <cl@linux-foundation.org> | 239 | Christoph Lameter <cl@linux-foundation.org> |
| 235 | Description: | 240 | Description: |
| 236 | The free_frozen file is read-only and specifies how many | 241 | The free_frozen file shows how many objects have been freed to |
| 237 | objects have been freed to a frozen slab (i.e. a remote cpu | 242 | a frozen slab (i.e. a remote cpu slab). It can be written to |
| 238 | slab). | 243 | clear the current count. |
| 239 | Available when CONFIG_SLUB_STATS is enabled. | 244 | Available when CONFIG_SLUB_STATS is enabled. |
| 240 | 245 | ||
| 241 | What: /sys/kernel/slab/cache/free_remove_partial | 246 | What: /sys/kernel/slab/cache/free_remove_partial |
| @@ -244,9 +249,10 @@ KernelVersion: 2.6.25 | |||
| 244 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 249 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 245 | Christoph Lameter <cl@linux-foundation.org> | 250 | Christoph Lameter <cl@linux-foundation.org> |
| 246 | Description: | 251 | Description: |
| 247 | The file free_remove_partial is read-only and specifies how | 252 | The free_remove_partial file shows how many times an object has |
| 248 | many times an object has been freed to a now-empty slab so | 253 | been freed to a now-empty slab so that it had to be removed from |
| 249 | that it had to be removed from its node's partial list. | 254 | its node's partial list. It can be written to clear the current |
| 255 | count. | ||
| 250 | Available when CONFIG_SLUB_STATS is enabled. | 256 | Available when CONFIG_SLUB_STATS is enabled. |
| 251 | 257 | ||
| 252 | What: /sys/kernel/slab/cache/free_slab | 258 | What: /sys/kernel/slab/cache/free_slab |
| @@ -255,8 +261,9 @@ KernelVersion: 2.6.25 | |||
| 255 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 261 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 256 | Christoph Lameter <cl@linux-foundation.org> | 262 | Christoph Lameter <cl@linux-foundation.org> |
| 257 | Description: | 263 | Description: |
| 258 | The free_slab file is read-only and specifies how many times an | 264 | The free_slab file shows how many times an empty slab has been |
| 259 | empty slab has been freed back to the page allocator. | 265 | freed back to the page allocator. It can be written to clear |
| 266 | the current count. | ||
| 260 | Available when CONFIG_SLUB_STATS is enabled. | 267 | Available when CONFIG_SLUB_STATS is enabled. |
| 261 | 268 | ||
| 262 | What: /sys/kernel/slab/cache/free_slowpath | 269 | What: /sys/kernel/slab/cache/free_slowpath |
| @@ -265,9 +272,9 @@ KernelVersion: 2.6.25 | |||
| 265 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 272 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 266 | Christoph Lameter <cl@linux-foundation.org> | 273 | Christoph Lameter <cl@linux-foundation.org> |
| 267 | Description: | 274 | Description: |
| 268 | The free_slowpath file is read-only and specifies how many | 275 | The free_slowpath file shows how many objects have been freed |
| 269 | objects have been freed using the slow path (i.e. to a full or | 276 | using the slow path (i.e. to a full or partial slab). It can |
| 270 | partial slab). | 277 | be written to clear the current count. |
| 271 | Available when CONFIG_SLUB_STATS is enabled. | 278 | Available when CONFIG_SLUB_STATS is enabled. |
| 272 | 279 | ||
| 273 | What: /sys/kernel/slab/cache/hwcache_align | 280 | What: /sys/kernel/slab/cache/hwcache_align |
| @@ -346,10 +353,10 @@ KernelVersion: 2.6.26 | |||
| 346 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, | 353 | Contact: Pekka Enberg <penberg@cs.helsinki.fi>, |
| 347 | Christoph Lameter <cl@linux-foundation.org> | 354 | Christoph Lameter <cl@linux-foundation.org> |
| 348 | Description: | 355 | Description: |
| 349 | The file order_fallback is read-only and specifies how many | 356 | The order_fallback file shows how many times an allocation of a |
| 350 | times an allocation of a new slab has not been possible at the | 357 | new slab has not been possible at the cache's order and instead |
| 351 | cache's order and instead fallen back to its minimum possible | 358 | fallen back to its minimum possible order. It can be written to |
| 352 | order. | 359 | clear the current count. |
| 353 | Available when CONFIG_SLUB_STATS is enabled. | 360 | Available when CONFIG_SLUB_STATS is enabled. |
| 354 | 361 | ||
| 355 | What: /sys/kernel/slab/cache/partial | 362 | What: /sys/kernel/slab/cache/partial |
| @@ -4371,12 +4371,28 @@ static int show_stat(struct kmem_cache *s, char *buf, enum stat_item si) | |||
| 4371 | return len + sprintf(buf + len, "\n"); | 4371 | return len + sprintf(buf + len, "\n"); |
| 4372 | } | 4372 | } |
| 4373 | 4373 | ||
| 4374 | static void clear_stat(struct kmem_cache *s, enum stat_item si) | ||
| 4375 | { | ||
| 4376 | int cpu; | ||
| 4377 | |||
| 4378 | for_each_online_cpu(cpu) | ||
| 4379 | get_cpu_slab(s, cpu)->stat[si] = 0; | ||
| 4380 | } | ||
| 4381 | |||
| 4374 | #define STAT_ATTR(si, text) \ | 4382 | #define STAT_ATTR(si, text) \ |
| 4375 | static ssize_t text##_show(struct kmem_cache *s, char *buf) \ | 4383 | static ssize_t text##_show(struct kmem_cache *s, char *buf) \ |
| 4376 | { \ | 4384 | { \ |
| 4377 | return show_stat(s, buf, si); \ | 4385 | return show_stat(s, buf, si); \ |
| 4378 | } \ | 4386 | } \ |
| 4379 | SLAB_ATTR_RO(text); \ | 4387 | static ssize_t text##_store(struct kmem_cache *s, \ |
| 4388 | const char *buf, size_t length) \ | ||
| 4389 | { \ | ||
| 4390 | if (buf[0] != '0') \ | ||
| 4391 | return -EINVAL; \ | ||
| 4392 | clear_stat(s, si); \ | ||
| 4393 | return length; \ | ||
| 4394 | } \ | ||
| 4395 | SLAB_ATTR(text); \ | ||
| 4380 | 4396 | ||
| 4381 | STAT_ATTR(ALLOC_FASTPATH, alloc_fastpath); | 4397 | STAT_ATTR(ALLOC_FASTPATH, alloc_fastpath); |
| 4382 | STAT_ATTR(ALLOC_SLOWPATH, alloc_slowpath); | 4398 | STAT_ATTR(ALLOC_SLOWPATH, alloc_slowpath); |
