Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27077
b: refs/heads/master
c: b1ab41c
h: refs/heads/master
i:
  27075: 15c3d88
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jun 2, 2006
1 parent 12f02ec commit 96656bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 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: b52a834892f17b6c54c34ab65f1fad1a9229e764
refs/heads/master: b1ab41c4943008375c149a63602d7407f61de5b2
27 changes: 13 additions & 14 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ typedef unsigned int kmem_bufctl_t;
#define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2)
#define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3)

/* Max number of objs-per-slab for caches which use off-slab slabs.
* Needed to avoid a possible looping condition in cache_grow().
*/
static unsigned long offslab_limit;

/*
* struct slab
*
Expand Down Expand Up @@ -1356,12 +1351,6 @@ void __init kmem_cache_init(void)
NULL, NULL);
}

/* Inc off-slab bufctl limit until the ceiling is hit. */
if (!(OFF_SLAB(sizes->cs_cachep))) {
offslab_limit = sizes->cs_size - sizeof(struct slab);
offslab_limit /= sizeof(kmem_bufctl_t);
}

sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
sizes->cs_size,
ARCH_KMALLOC_MINALIGN,
Expand Down Expand Up @@ -1780,6 +1769,7 @@ static void set_up_list3s(struct kmem_cache *cachep, int index)
static size_t calculate_slab_order(struct kmem_cache *cachep,
size_t size, size_t align, unsigned long flags)
{
unsigned long offslab_limit;
size_t left_over = 0;
int gfporder;

Expand All @@ -1791,9 +1781,18 @@ static size_t calculate_slab_order(struct kmem_cache *cachep,
if (!num)
continue;

/* More than offslab_limit objects will cause problems */
if ((flags & CFLGS_OFF_SLAB) && num > offslab_limit)
break;
if (flags & CFLGS_OFF_SLAB) {
/*
* Max number of objs-per-slab for caches which
* use off-slab slabs. Needed to avoid a possible
* looping condition in cache_grow().
*/
offslab_limit = size - sizeof(struct slab);
offslab_limit /= sizeof(kmem_bufctl_t);

if (num > offslab_limit)
break;
}

/* Found something acceptable - save it away */
cachep->num = num;
Expand Down

0 comments on commit 96656bb

Please sign in to comment.