Re: 4.0.0-rc4: panic in free_block

From: David Ahern
Date: Sun Mar 22 2015 - 20:03:43 EST


On 3/22/15 5:54 PM, David Miller wrote:
I just put it on 4.0.0-rc4 and ditto -- problem goes away, so it
clearly suggests the memcpy or memmove are the root cause.

Thanks, didn't notice that.

So, something is amuck.

to continue to refine the problem ... I modified only the memmove lines (not the memcpy) and it works fine. So its the memmove.

I'm sure this will get whitespaced damaged on the copy and paste but to be clear this is the patch I am currently running and system is stable. On Friday it failed on every single; with this patch I have allyesconfig builds with -j 128 in a loop (clean in between) and nothing -- no panics.

diff --git a/mm/slab.c b/mm/slab.c
index c4b89ea..f5e9716 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -802,6 +802,16 @@ static inline void ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac,
ac->entry[ac->avail++] = objp;
}

+static void move_entries(void *dest, void *src, int nr)
+{
+ unsigned long *dp = dest;
+ unsigned long *sp = src;
+
+ for (; nr; nr--, dp++, sp++)
+ *dp = *sp;
+}
+
+
/*
* Transfer objects in one arraycache to another.
* Locking must be handled by the caller.
@@ -3344,7 +3354,7 @@ free_done:
spin_unlock(&n->list_lock);
slabs_destroy(cachep, &list);
ac->avail -= batchcount;
- memmove(ac->entry, &(ac->entry[batchcount]), sizeof(void *)*ac->avail);
+ move_entries(ac->entry, &(ac->entry[batchcount]), ac->avail);
}

/*
@@ -3817,8 +3827,7 @@ static void drain_array(struct kmem_cache *cachep, struct kmem_cache_node *n,
tofree = (ac->avail + 1) / 2;
free_block(cachep, ac->entry, tofree, node, &list);
ac->avail -= tofree;
- memmove(ac->entry, &(ac->entry[tofree]),
- sizeof(void *) * ac->avail);
+ move_entries(ac->entry, &(ac->entry[tofree]), ac->avail);
}
spin_unlock_irq(&n->list_lock);
slabs_destroy(cachep, &list);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/