Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
  slab: rename slab_destroy_objs
  slub: current is always valid
  slub: Add check for kfree() of non slab objects.
This commit is contained in:
Linus Torvalds 2008-07-15 11:26:14 -07:00
commit b9d2252c1e
2 changed files with 5 additions and 12 deletions

View file

@ -1901,15 +1901,7 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
#endif #endif
#if DEBUG #if DEBUG
/** static void slab_destroy_debugcheck(struct kmem_cache *cachep, struct slab *slabp)
* slab_destroy_objs - destroy a slab and its objects
* @cachep: cache pointer being destroyed
* @slabp: slab pointer being destroyed
*
* Call the registered destructor for each object in a slab that is being
* destroyed.
*/
static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp)
{ {
int i; int i;
for (i = 0; i < cachep->num; i++) { for (i = 0; i < cachep->num; i++) {
@ -1938,7 +1930,7 @@ static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp)
} }
} }
#else #else
static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp) static void slab_destroy_debugcheck(struct kmem_cache *cachep, struct slab *slabp)
{ {
} }
#endif #endif
@ -1956,7 +1948,7 @@ static void slab_destroy(struct kmem_cache *cachep, struct slab *slabp)
{ {
void *addr = slabp->s_mem - slabp->colouroff; void *addr = slabp->s_mem - slabp->colouroff;
slab_destroy_objs(cachep, slabp); slab_destroy_debugcheck(cachep, slabp);
if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) { if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) {
struct slab_rcu *slab_rcu; struct slab_rcu *slab_rcu;

View file

@ -411,7 +411,7 @@ static void set_track(struct kmem_cache *s, void *object,
if (addr) { if (addr) {
p->addr = addr; p->addr = addr;
p->cpu = smp_processor_id(); p->cpu = smp_processor_id();
p->pid = current ? current->pid : -1; p->pid = current->pid;
p->when = jiffies; p->when = jiffies;
} else } else
memset(p, 0, sizeof(struct track)); memset(p, 0, sizeof(struct track));
@ -2766,6 +2766,7 @@ void kfree(const void *x)
page = virt_to_head_page(x); page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) { if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
put_page(page); put_page(page);
return; return;
} }