summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-25 01:11:35 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-25 01:11:35 -0700
commit8f542f30d5e1cb777d7d97138285fd75ab6c2fdd (patch)
tree9737535d9fd6e6d051d7a8531e54aef0835b7ea3 /include
parentd6686d54d3c543baf5fb19368c82ae1b5e4d7165 (diff)
[PATCH] slab: account for reclaimable caches
We have a problem at present in vm_enough_memory(): it uses smoke-n-mirrors to try to work out how much memory can be reclaimed from dcache and icache. it sometimes gets it quite wrong, especially if the slab has internal fragmentation. And it often does. So here we take a new approach. Rather than trying to work out how many pages are reclaimable by counting up the number of inodes and dentries, we change the slab allocator to keep count of how many pages are currently used by slabs which can be shrunk by the VM. The creator of the slab marks the slab as being reclaimable at kmem_cache_create()-time. Slab keeps a global counter of pages which are currently in use by thus-tagged slabs. Of course, we now slightly overestimate the amount of reclaimable memory, because not _all_ of the icache, dcache, mbcache and quota caches are reclaimable. But I think it's better to be a bit permissive rather than bogusly failing brk() calls as we do at present.
Diffstat (limited to 'include')
-rw-r--r--include/linux/slab.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b2b6f0498e2a..3e4e5491102c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -41,6 +41,8 @@ typedef struct kmem_cache_s kmem_cache_t;
#define SLAB_CACHE_DMA 0x00004000UL /* use GFP_DMA memory */
#define SLAB_MUST_HWCACHE_ALIGN 0x00008000UL /* force alignment */
#define SLAB_STORE_USER 0x00010000UL /* store the last owner for bug hunting */
+#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* track pages allocated to indicate
+ what is reclaimable later*/
/* flags passed to a constructor func */
#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */