summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-12-01 15:44:12 +0100
committerRichard Braun <rbraun@sceen.net>2012-12-01 15:44:12 +0100
commit7226ab8883555e2f3806e6d2ff3773cbb8756a4e (patch)
treef45be9b6cc177e1ee839684b1da51ce527770353
parentc115b38c1bcc680cbe0c55409f2522fcc96f3230 (diff)
kern/kmem: remove the KMEM_CACHE_NORECLAIM flag
Don't encourage anyone to use non reclaimable pools of resources, it's a Bad Thing To Do.
-rw-r--r--kern/kmem.c17
-rw-r--r--kern/kmem.h15
2 files changed, 8 insertions, 24 deletions
diff --git a/kern/kmem.c b/kern/kmem.c
index be2c78c7..af3eccac 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -270,7 +270,6 @@ kmem_slab_create(struct kmem_cache *cache, size_t color)
return NULL;
if (cache->flags & KMEM_CF_SLAB_EXTERNAL) {
- assert(!(cache->flags & KMEM_CF_NO_RECLAIM));
slab = kmem_cache_alloc(&kmem_slab_cache);
if (slab == NULL) {
@@ -543,12 +542,6 @@ kmem_cache_init(struct kmem_cache *cache, const char *name, size_t obj_size,
if (flags & KMEM_CACHE_NOCPUPOOL)
cache->flags |= KMEM_CF_NO_CPU_POOL;
- if (flags & KMEM_CACHE_NORECLAIM) {
- assert(slab_free_fn == NULL);
- flags |= KMEM_CACHE_NOOFFSLAB;
- cache->flags |= KMEM_CF_NO_RECLAIM;
- }
-
if (flags & KMEM_CACHE_VERIFY)
cache->flags |= KMEM_CF_VERIFY;
@@ -1257,7 +1250,6 @@ kmem_info(void)
{
struct kmem_cache *cache, *cache_stats;
size_t mem_usage, mem_reclaimable;
- int not_reclaimable;
cache_stats = kmem_alloc(sizeof(*cache_stats));
@@ -1275,7 +1267,6 @@ kmem_info(void)
list_for_each_entry(&kmem_cache_list, cache, node) {
/* mutex_lock(&cache->mutex); */
- not_reclaimable = cache->flags & KMEM_CF_NO_RECLAIM;
cache_stats->obj_size = cache->obj_size;
cache_stats->slab_size = cache->slab_size;
cache_stats->bufs_per_slab = cache->bufs_per_slab;
@@ -1287,12 +1278,8 @@ kmem_info(void)
/* mutex_unlock(&cache->mutex); */
mem_usage = (cache_stats->nr_slabs * cache_stats->slab_size) >> 10;
-
- if (not_reclaimable)
- mem_reclaimable = 0;
- else
- mem_reclaimable =
- (cache_stats->nr_free_slabs * cache_stats->slab_size) >> 10;
+ mem_reclaimable =
+ (cache_stats->nr_free_slabs * cache_stats->slab_size) >> 10;
printk("kmem: %-19s %6zu %3zuk %4lu %6lu %6lu %7zuk %10zuk\n",
cache_stats->name, cache_stats->obj_size,
diff --git a/kern/kmem.h b/kern/kmem.h
index f0beec11..169497c2 100644
--- a/kern/kmem.h
+++ b/kern/kmem.h
@@ -182,11 +182,10 @@ typedef void (*kmem_slab_free_fn_t)(unsigned long, size_t);
*
* The flags don't change once set and can be tested without locking.
*/
-#define KMEM_CF_NO_CPU_POOL 0x01 /* CPU pool layer disabled */
-#define KMEM_CF_SLAB_EXTERNAL 0x02 /* Slab data is off slab */
-#define KMEM_CF_NO_RECLAIM 0x04 /* Slabs are not reclaimable */
-#define KMEM_CF_VERIFY 0x08 /* Debugging facilities enabled */
-#define KMEM_CF_DIRECT 0x10 /* No buf-to-slab tree lookup */
+#define KMEM_CF_NO_CPU_POOL 0x1 /* CPU pool layer disabled */
+#define KMEM_CF_SLAB_EXTERNAL 0x2 /* Slab data is off slab */
+#define KMEM_CF_VERIFY 0x4 /* Debugging facilities enabled */
+#define KMEM_CF_DIRECT 0x8 /* No buf-to-slab tree lookup */
/*
* Cache of objects.
@@ -237,15 +236,13 @@ struct kmem_cache {
*/
#define KMEM_CACHE_NOCPUPOOL 0x1 /* Don't use the per-cpu pools */
#define KMEM_CACHE_NOOFFSLAB 0x2 /* Don't allocate external slab data */
-#define KMEM_CACHE_NORECLAIM 0x4 /* Never give slabs back to their source,
- implies KMEM_CACHE_NOOFFSLAB */
-#define KMEM_CACHE_VERIFY 0x8 /* Use debugging facilities */
+#define KMEM_CACHE_VERIFY 0x4 /* Use debugging facilities */
/*
* Initialize a cache.
*
* If a slab allocation/free function pointer is NULL, the default backend
- * (vm_kmem on the kmem map) is used for the allocation/free action.
+ * (vm_kmem on the kernel map) is used for the allocation/free action.
*/
void kmem_cache_init(struct kmem_cache *cache, const char *name,
size_t obj_size, size_t align, kmem_cache_ctor_t ctor,