Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28897
b: refs/heads/master
c: 4776874
h: refs/heads/master
i:
  28895: 2d4ae56
v: v3
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed Jun 23, 2006
1 parent 25185a6 commit e02c298
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 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: f886ed443fedb109e2062988bf120a531f0ec80a
refs/heads/master: 4776874ff096cd410382c0eca5d75f69c9dfa58f
27 changes: 16 additions & 11 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2499,23 +2499,28 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp,
slabp->inuse--;
}

static void set_slab_attr(struct kmem_cache *cachep, struct slab *slabp,
void *objp)
/*
* Map pages beginning at addr to the given cache and slab. This is required
* for the slab allocator to be able to lookup the cache and slab of a
* virtual address for kfree, ksize, kmem_ptr_validate, and slab debugging.
*/
static void slab_map_pages(struct kmem_cache *cache, struct slab *slab,
void *addr)
{
int i;
int nr_pages;
struct page *page;

/* Nasty!!!!!! I hope this is OK. */
page = virt_to_page(objp);
page = virt_to_page(addr);

i = 1;
nr_pages = 1;
if (likely(!PageCompound(page)))
i <<= cachep->gfporder;
nr_pages <<= cache->gfporder;

do {
page_set_cache(page, cachep);
page_set_slab(page, slabp);
page_set_cache(page, cache);
page_set_slab(page, slab);
page++;
} while (--i);
} while (--nr_pages);
}

/*
Expand Down Expand Up @@ -2587,7 +2592,7 @@ static int cache_grow(struct kmem_cache *cachep, gfp_t flags, int nodeid)
goto opps1;

slabp->nodeid = nodeid;
set_slab_attr(cachep, slabp, objp);
slab_map_pages(cachep, slabp, objp);

cache_init_objs(cachep, slabp, ctor_flags);

Expand Down

0 comments on commit e02c298

Please sign in to comment.