Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19385
b: refs/heads/master
c: 12dd36f
h: refs/heads/master
i:
  19383: fed2f13
v: v3
  • Loading branch information
Matthew Dobson authored and Linus Torvalds committed Feb 1, 2006
1 parent c6d9c49 commit 5edcc75
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fbaccacff1f17c65ae0972085368a7ec75be6062
refs/heads/master: 12dd36faec5d3bd96da84fa8f76efecc632930ab
26 changes: 19 additions & 7 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,15 +1459,13 @@ static void check_poison_obj(kmem_cache_t *cachep, void *objp)
}
#endif

/* Destroy all the objs in a slab, and release the mem back to the system.
* Before calling the slab must have been unlinked from the cache.
* The cache-lock is not held/needed.
#if DEBUG
/**
* slab_destroy_objs - call the registered destructor for each object in
* a slab that is to be destroyed.
*/
static void slab_destroy(kmem_cache_t *cachep, struct slab *slabp)
static void slab_destroy_objs(kmem_cache_t *cachep, struct slab *slabp)
{
void *addr = slabp->s_mem - slabp->colouroff;

#if DEBUG
int i;
for (i = 0; i < cachep->num; i++) {
void *objp = slabp->s_mem + cachep->buffer_size * i;
Expand Down Expand Up @@ -1496,16 +1494,30 @@ static void slab_destroy(kmem_cache_t *cachep, struct slab *slabp)
if (cachep->dtor && !(cachep->flags & SLAB_POISON))
(cachep->dtor) (objp + obj_offset(cachep), cachep, 0);
}
}
#else
static void slab_destroy_objs(kmem_cache_t *cachep, struct slab *slabp)
{
if (cachep->dtor) {
int i;
for (i = 0; i < cachep->num; i++) {
void *objp = slabp->s_mem + cachep->buffer_size * i;
(cachep->dtor) (objp, cachep, 0);
}
}
}
#endif

/**
* Destroy all the objs in a slab, and release the mem back to the system.
* Before calling the slab must have been unlinked from the cache.
* The cache-lock is not held/needed.
*/
static void slab_destroy(kmem_cache_t *cachep, struct slab *slabp)
{
void *addr = slabp->s_mem - slabp->colouroff;

slab_destroy_objs(cachep, slabp);
if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) {
struct slab_rcu *slab_rcu;

Expand Down

0 comments on commit 5edcc75

Please sign in to comment.