summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-09 23:32:57 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-09 23:32:57 +0200
commit69498acfbb9e9e80dde3e0b777e5b4f00b73b1a9 (patch)
tree835fbcf88ed082279a09ab354be1f94e1434e77c
parent63e94ea48ad692f506e8db51e64cf3f710d58a71 (diff)
parentcf79b6a9a9d4ceef4f69d0e8c691cd198863cd67 (diff)
Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumach
-rw-r--r--kern/slab.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/kern/slab.c b/kern/slab.c
index 56fadbf..5c697cd 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -615,18 +615,24 @@ static inline void kmem_cpu_pool_push(struct kmem_cpu_pool *cpu_pool, void *obj)
static int kmem_cpu_pool_fill(struct kmem_cpu_pool *cpu_pool,
struct kmem_cache *cache)
{
- void *obj;
+ kmem_cache_ctor_t ctor;
+ void *buf;
int i;
+ ctor = (cpu_pool->flags & KMEM_CF_VERIFY) ? NULL : cache->ctor;
+
simple_lock(&cache->lock);
for (i = 0; i < cpu_pool->transfer_size; i++) {
- obj = kmem_cache_alloc_from_slab(cache);
+ buf = kmem_cache_alloc_from_slab(cache);
- if (obj == NULL)
+ if (buf == NULL)
break;
- kmem_cpu_pool_push(cpu_pool, obj);
+ if (ctor != NULL)
+ ctor(buf);
+
+ kmem_cpu_pool_push(cpu_pool, buf);
}
simple_unlock(&cache->lock);