From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Paul Mundt <lethal@linux-sh.org>,
linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org,
linux-mm@vger.kernel.org,
Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH] slab: fix slab flags for archs use alignment larger 64-bit
Date: Fri, 13 Feb 2009 15:11:36 +0100 [thread overview]
Message-ID: <49957F98.50708@st.com> (raw)
In-Reply-To: <4995565D.5010105@st.com>
[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]
Giuseppe CAVALLARO wrote:
> Pekka Enberg wrote:
>
>> Hi Giuseppe,
>>
>> On Fri, Feb 13, 2009 at 12:46 PM, Giuseppe CAVALLARO
>> <peppe.cavallaro@st.com> wrote:
>>
>>
>>> 1) LOG with my patch:
>>> root@linux:~# cat /proc/meminfo | grep Slab
>>> Slab: 2612 kB
>>>
>>> 2) LOG without my patch:
>>> root@linux:~# cat /proc/meminfo | grep Slab
>>> Slab: 2504 kB
>>>
>>>
>> That's not too bad. I assume it's L1_CACHE_BYTES set to 32 bytes?
>>
> you are perfectly right.
>
>> One big problem with your patch is that on some MIPS configurations
>> ARCH_KMALLOC_MINALIGN is as big as 128.
>>
> Agree again and problem understood... thanks!
>
>> So if you're going to do this, you can't use ARCH_KMALLOC_MINALIGN directly but add a some
>> SLAB_MAX_DEBUG_ALIGN which can be overridden by architecture code.
>>
>>
> If you like, I can prepare a patch in any case.
> Then we can decide if it actually adds complexity and discard it.
> Otherwise we could maintain it.
>
>> One obvious question, though, is whether all this is worth the added
>> complexity. I mean, we've managed "just fine" without it for years.
>> Paul, thoughts?
>>
>> Pekka
>>
>>
Hi!
as promised, patches attached.
At any rate, (this is just my feeling) although we add more complexity
this kind of 'fixes' can actually help users to debug.
So, complexity is welcome especially in these scenarios (debug on, users
in panic mode :-)).
Let me know.
Cheers,
Peppe
[-- Attachment #2: 0001-slab-fix-the-debug-information-with-different-align.patch --]
[-- Type: text/plain, Size: 1340 bytes --]
>From 86c7fe861b4a6ee7b533a25ce2c506134a7533a8 Mon Sep 17 00:00:00 2001
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Fri, 13 Feb 2009 15:06:22 +0100
Subject: [PATCH] slab: fix the debug information with different alignments.
This patch is to fix the debug information reported in /proc/slab_allocators
for all the architectures by using a new define (ARCH_SLAB_MAX_DEBUG_ALIGN)
rather than the alignment of a 64-bit integer.
Currently, on sh, for example, /proc/slab_allocators has no size-X entries
as side effect.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
mm/slab.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 4d00855..587e0f3 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -165,6 +165,10 @@
#define ARCH_SLAB_MINALIGN 0
#endif
+#ifndef ARCH_SLAB_MAX_DEBUG_ALIGN
+#define ARCH_SLAB_MAX_DEBUG_ALIGN __alignof__(unsigned long long)
+#endif
+
#ifndef ARCH_KMALLOC_FLAGS
#define ARCH_KMALLOC_FLAGS SLAB_HWCACHE_ALIGN
#endif
@@ -2262,7 +2266,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
ralign = align;
}
/* disable debug if necessary */
- if (ralign > __alignof__(unsigned long long))
+ if (ralign > ARCH_SLAB_MAX_DEBUG_ALIGN)
flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
/*
* 4) Store it.
--
1.5.6.6
[-- Attachment #3: 0002-sh-add-the-default-value-for-ARCH_SLAB_MAX_DEBUG_AL.patch --]
[-- Type: text/plain, Size: 813 bytes --]
>From 3b461766df1841f03e740b91efc38132eae74f86 Mon Sep 17 00:00:00 2001
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Fri, 13 Feb 2009 15:06:39 +0100
Subject: [PATCH] sh: add the default value for ARCH_SLAB_MAX_DEBUG_ALIGN define.
Add and enforce ARCH_SLAB_MAX_DEBUG_ALIGN to the cache line size.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
arch/sh/include/asm/page.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 5871d78..14768c8 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -182,4 +182,6 @@ typedef struct page *pgtable_t;
#define ARCH_SLAB_MINALIGN 8
#endif
+#define ARCH_SLAB_MAX_DEBUG_ALIGN L1_CACHE_BYTES
+
#endif /* __ASM_SH_PAGE_H */
--
1.5.6.6
next prev parent reply other threads:[~2009-02-13 13:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-12 17:51 [PATCH] slab: fix slab flags for archs use alignment larger 64-bit Giuseppe CAVALLARO
2009-02-12 18:56 ` Paul Mundt
2009-02-13 10:00 ` Giuseppe CAVALLARO
2009-02-13 9:22 ` Pekka Enberg
2009-02-13 9:30 ` Pekka Enberg
2009-02-13 10:46 ` Giuseppe CAVALLARO
2009-02-13 10:05 ` Pekka Enberg
2009-02-13 11:15 ` Giuseppe CAVALLARO
2009-02-13 14:11 ` Giuseppe CAVALLARO [this message]
2009-02-13 13:41 ` Pekka Enberg
2009-02-18 9:30 ` Giuseppe CAVALLARO
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49957F98.50708@st.com \
--to=peppe.cavallaro@st.com \
--cc=cl@linux-foundation.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox