Re: v3.15-rc1 slab allocator broken on m68knommu (coldfire)

From: Steven King
Date: Wed Apr 16 2014 - 11:54:22 EST


On Tuesday 15 April 2014 5:19:31 pm Joonsoo Kim wrote:
> On Mon, Apr 14, 2014 at 05:45:43PM -0700, Steven King wrote:
> > git bisect suggests it starts somewhere around commit
> > f315e3fa1cf5b3317fc948708645fff889ce1e63 slab: restrict the number of
> > objects in a slab
> >
> > but its kinda hard to tell as there is some compile breakage in there as
> > well.
>
> Hello, Steven.
>
> Hmm... there is the fix on upstream v3.15-rc1 for build breakage.
> See commit 24f870d('slab: fix wrongly used macro').
> If slab allocator broken with this fix, please let me know.
>
> Thanks.


Yes, 24f870d fixes the build breakage but the allocator is still broken (board
doesn't boot). However, I was able to track down the exact changes that seem
to break things; in 8dcc774 'slab: introduce byte sized index for the freelist of a slab'
there are the changes to get_free_obj and set_free_obj:

-static inline unsigned int get_free_obj(struct page *page, unsigned int idx)
+static inline freelist_idx_t get_free_obj(struct page *page, unsigned char idx)
{
- return ((unsigned int *)page->freelist)[idx];
+ return ((freelist_idx_t *)page->freelist)[idx];
}

static inline void set_free_obj(struct page *page,
- unsigned int idx, unsigned int val)
+ unsigned char idx, freelist_idx_t val)
{
- ((unsigned int *)(page->freelist))[idx] = val;
+ ((freelist_idx_t *)(page->freelist))[idx] = val;
}

if I change idx back to unsigned int, ie:

diff --git a/mm/slab.c b/mm/slab.c
index 388cb1a..d7f9f44 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2572,13 +2572,13 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
return freelist;
}

-static inline freelist_idx_t get_free_obj(struct page *page, unsigned char idx)
+static inline freelist_idx_t get_free_obj(struct page *page, unsigned int idx)
{
return ((freelist_idx_t *)page->freelist)[idx];
}

static inline void set_free_obj(struct page *page,
- unsigned char idx, freelist_idx_t val)
+ unsigned int idx, freelist_idx_t val)
{
((freelist_idx_t *)(page->freelist))[idx] = val;
}


then v3.15-rc1 will boot using the slab allocator.
--
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/