* slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
@ 2008-07-03 14:14 Christoph Lameter
2008-07-03 15:37 ` Pekka Enberg
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2008-07-03 14:14 UTC (permalink / raw)
To: Pekka Enberg; +Cc: Matt Mackall, Yoichi Yuasa, linux-kernel
The 192 byte cache is not necessary if we have a basic alignment of 128
byte. If it would be used then the 192 would be aligned to the next 128 byte
boundary which would result in another 256 byte cache. Two 256 kmalloc caches
cause sysfs to complain about a duplicate entry.
MIPS needs 128 byte aligned kmalloc caches and spits out warnings on boot without
this patch.
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Index: linux-2.6/include/linux/slub_def.h
===================================================================
--- linux-2.6.orig/include/linux/slub_def.h 2008-07-02 13:57:29.000000000 -0500
+++ linux-2.6/include/linux/slub_def.h 2008-07-02 13:58:00.000000000 -0500
@@ -137,10 +137,12 @@
if (size <= KMALLOC_MIN_SIZE)
return KMALLOC_SHIFT_LOW;
+#if KMALLOC_MIN_SIZE <= 64
if (size > 64 && size <= 96)
return 1;
if (size > 128 && size <= 192)
return 2;
+#endif
if (size <= 8) return 3;
if (size <= 16) return 4;
if (size <= 32) return 5;
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2008-07-02 13:57:29.000000000 -0500
+++ linux-2.6/mm/slub.c 2008-07-02 13:58:07.000000000 -0500
@@ -2995,8 +2995,6 @@
create_kmalloc_cache(&kmalloc_caches[1],
"kmalloc-96", 96, GFP_KERNEL);
caches++;
- }
- if (KMALLOC_MIN_SIZE <= 128) {
create_kmalloc_cache(&kmalloc_caches[2],
"kmalloc-192", 192, GFP_KERNEL);
caches++;
@@ -3026,6 +3024,16 @@
for (i = 8; i < KMALLOC_MIN_SIZE; i += 8)
size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW;
+ if (KMALLOC_MIN_SIZE == 128) {
+ /*
+ * The 192 byte sized cache is not used if the alignment
+ * is 128 byte. Redirect kmalloc to use the 256 byte cache
+ * instead.
+ */
+ for (i = 128 + 8; i <= 192; i += 8)
+ size_index[(i - 1) / 8] = 8;
+ }
+
slab_state = UP;
/* Provide the correct kmalloc names now that the caches are up */
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
2008-07-03 14:14 slub: Do not use 192 byte sized cache if minimum alignment is 128 byte Christoph Lameter
@ 2008-07-03 15:37 ` Pekka Enberg
2008-07-03 16:09 ` Christoph Lameter
2008-07-04 0:28 ` Yoichi Yuasa
0 siblings, 2 replies; 5+ messages in thread
From: Pekka Enberg @ 2008-07-03 15:37 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Matt Mackall, Yoichi Yuasa, linux-kernel
On Thu, Jul 3, 2008 at 5:14 PM, Christoph Lameter
<cl@linux-foundation.org> wrote:
> The 192 byte cache is not necessary if we have a basic alignment of 128
> byte. If it would be used then the 192 would be aligned to the next 128 byte
> boundary which would result in another 256 byte cache. Two 256 kmalloc caches
> cause sysfs to complain about a duplicate entry.
>
> MIPS needs 128 byte aligned kmalloc caches and spits out warnings on boot without
> this patch.
>
> Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Looks good to me. Yoichi, did you have the chance to test this?
Christoph, are the warnings harmless or do we need to get this into
2.6.26?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
2008-07-03 15:37 ` Pekka Enberg
@ 2008-07-03 16:09 ` Christoph Lameter
2008-07-04 0:28 ` Yoichi Yuasa
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2008-07-03 16:09 UTC (permalink / raw)
To: Pekka Enberg; +Cc: Matt Mackall, Yoichi Yuasa, linux-kernel
I think this needs to go into .26.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
2008-07-03 15:37 ` Pekka Enberg
2008-07-03 16:09 ` Christoph Lameter
@ 2008-07-04 0:28 ` Yoichi Yuasa
2008-07-04 7:38 ` Pekka Enberg
1 sibling, 1 reply; 5+ messages in thread
From: Yoichi Yuasa @ 2008-07-04 0:28 UTC (permalink / raw)
To: Pekka Enberg; +Cc: yoichi_yuasa, Christoph Lameter, Matt Mackall, linux-kernel
On Thu, 3 Jul 2008 18:37:52 +0300
"Pekka Enberg" <penberg@cs.helsinki.fi> wrote:
> On Thu, Jul 3, 2008 at 5:14 PM, Christoph Lameter
> <cl@linux-foundation.org> wrote:
> > The 192 byte cache is not necessary if we have a basic alignment of 128
> > byte. If it would be used then the 192 would be aligned to the next 128 byte
> > boundary which would result in another 256 byte cache. Two 256 kmalloc caches
> > cause sysfs to complain about a duplicate entry.
> >
> > MIPS needs 128 byte aligned kmalloc caches and spits out warnings on boot without
> > this patch.
> >
> > Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
>
> Looks good to me. Yoichi, did you have the chance to test this?
I've already done.
It has no problem.
Yoichi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte
2008-07-04 0:28 ` Yoichi Yuasa
@ 2008-07-04 7:38 ` Pekka Enberg
0 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2008-07-04 7:38 UTC (permalink / raw)
To: Yoichi Yuasa; +Cc: Christoph Lameter, Matt Mackall, linux-kernel
Hi Yoichi,
On Thu, Jul 3, 2008 at 5:14 PM, Christoph Lameter
<cl@linux-foundation.org> wrote:
>>> The 192 byte cache is not necessary if we have a basic alignment of 128
>>> byte. If it would be used then the 192 would be aligned to the next 128 byte
>>> boundary which would result in another 256 byte cache. Two 256 kmalloc caches
>>> cause sysfs to complain about a duplicate entry.
>>>
>>> MIPS needs 128 byte aligned kmalloc caches and spits out warnings on boot without
>>> this patch.
>>>
>>> Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
On Thu, 3 Jul 2008 18:37:52 +0300
"Pekka Enberg" <penberg@cs.helsinki.fi> wrote:
>> Looks good to me. Yoichi, did you have the chance to test this?
On Fri, Jul 4, 2008 at 3:28 AM, Yoichi Yuasa
<yoichi_yuasa@tripeaks.co.jp> wrote:
> I've already done.
> It has no problem.
Thank you for testing!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-04 7:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 14:14 slub: Do not use 192 byte sized cache if minimum alignment is 128 byte Christoph Lameter
2008-07-03 15:37 ` Pekka Enberg
2008-07-03 16:09 ` Christoph Lameter
2008-07-04 0:28 ` Yoichi Yuasa
2008-07-04 7:38 ` Pekka Enberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.