Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60730
b: refs/heads/master
c: 5b95a4a
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Jul 17, 2007
1 parent 6bd1ab2 commit d3de0be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 39 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: 2492268472e7d326a6fe10f92f9211c4578f2482
refs/heads/master: 5b95a4acf157eee552e013795b54eaa2ab1ee4a1
51 changes: 13 additions & 38 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ static struct kmem_cache *find_mergeable(size_t size,
size_t align, unsigned long flags,
void (*ctor)(void *, struct kmem_cache *, unsigned long))
{
struct list_head *h;
struct kmem_cache *s;

if (slub_nomerge || (flags & SLUB_NEVER_MERGE))
return NULL;
Expand All @@ -2585,10 +2585,7 @@ static struct kmem_cache *find_mergeable(size_t size,
align = calculate_alignment(flags, align, size);
size = ALIGN(size, align);

list_for_each(h, &slab_caches) {
struct kmem_cache *s =
container_of(h, struct kmem_cache, list);

list_for_each_entry(s, &slab_caches, list) {
if (slab_unmergeable(s))
continue;

Expand Down Expand Up @@ -2670,33 +2667,6 @@ void *kmem_cache_zalloc(struct kmem_cache *s, gfp_t flags)
EXPORT_SYMBOL(kmem_cache_zalloc);

#ifdef CONFIG_SMP
static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu)
{
struct list_head *h;

down_read(&slub_lock);
list_for_each(h, &slab_caches) {
struct kmem_cache *s =
container_of(h, struct kmem_cache, list);

func(s, cpu);
}
up_read(&slub_lock);
}

/*
* Version of __flush_cpu_slab for the case that interrupts
* are enabled.
*/
static void cpu_slab_flush(struct kmem_cache *s, int cpu)
{
unsigned long flags;

local_irq_save(flags);
__flush_cpu_slab(s, cpu);
local_irq_restore(flags);
}

/*
* Use the cpu notifier to insure that the cpu slabs are flushed when
* necessary.
Expand All @@ -2705,13 +2675,21 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
long cpu = (long)hcpu;
struct kmem_cache *s;
unsigned long flags;

switch (action) {
case CPU_UP_CANCELED:
case CPU_UP_CANCELED_FROZEN:
case CPU_DEAD:
case CPU_DEAD_FROZEN:
for_all_slabs(cpu_slab_flush, cpu);
down_read(&slub_lock);
list_for_each_entry(s, &slab_caches, list) {
local_irq_save(flags);
__flush_cpu_slab(s, cpu);
local_irq_restore(flags);
}
up_read(&slub_lock);
break;
default:
break;
Expand Down Expand Up @@ -3736,7 +3714,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)

static int __init slab_sysfs_init(void)
{
struct list_head *h;
struct kmem_cache *s;
int err;

err = subsystem_register(&slab_subsys);
Expand All @@ -3747,10 +3725,7 @@ static int __init slab_sysfs_init(void)

slab_state = SYSFS;

list_for_each(h, &slab_caches) {
struct kmem_cache *s =
container_of(h, struct kmem_cache, list);

list_for_each_entry(s, &slab_caches, list) {
err = sysfs_slab_add(s);
BUG_ON(err);
}
Expand Down

0 comments on commit d3de0be

Please sign in to comment.