From: Paul Mundt <paul.mundt@nokia.com>
To: akpm@osdl.org, anton@samba.org, richard.curnow@st.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] ARCH_SLAB_MINALIGN for 2.6.10-rc3
Date: Sun, 5 Dec 2004 20:25:54 +0200 [thread overview]
Message-ID: <20041205182554.GB21383@pointless.research.nokia.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3269 bytes --]
Some time ago Anton introduced a patch that removed cacheline alignment
for the slab caches, falling back on BYTES_PER_WORD instead. While this
is fine in the general sense, on sh64 it is the source of considerable
unaligned accesses.
For sh64, sizeof(void *) gives 4 bytes, whereas we actually want 8 byte
alignment (pretty much the same behaviour as what we had prior to Anton's
patch, and what we already do for ARCH_KMALLOC_MINALIGN).
Richard was the first to note this:
One new issue is that there are a lot of new unaligned fixups
occurring. I know where too - it's loads and stores to 8-byte fields
in inodes. The root cause is the patch by Anton Blanchard : "remove
cacheline alignment from inode slabs". I think before that forcing
the inodes to cacheline-alignment guaranteed 8-byte alignment, but now
that's been removed, we only get sizeof(void *) alignment. The
problem is that pretty much every call to kmem_cache_create, except
for the ones that create the kmalloc pool, specifies zero as the 3rd
arg (=align). (The ones that create the kmalloc pools specify
ARCH_KMALLOC_MINALIGN which I fixed a while back to 8 for sh64.)
Ideally we're going to have to come up with a fix for this one, since
the performance overhead of fixing up loads of inode accesses will be
pretty high. It's not obvious to me how to do this unobtrusively - we
need to either modify kmem_cache_create or modify every file that
calls it (and import the ARCH_KMALLOC_MINALIGN stuff into each one.)
I suspect that the KMALLOC alignment wants to be kept conceptually
separate from the alignment used to create slabs. So perhaps we could
propose a new ARCH_SLAB_MINALIGN or some such; if this is defined, the
maximum of this and the 'align' argument to kmem_cache_create is used
as the alignment for the slab created.
We have been using the attached ARCH_SLAB_MINALIGN patch for sh64 and this
seems like the least intrusive solution. Thoughts?
Signed-off-by: Paul Mundt <paul.mundt@nokia.com>
include/asm-sh64/uaccess.h | 6 ++++++
mm/slab.c | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
--- orig/include/asm-sh64/uaccess.h
+++ mod/include/asm-sh64/uaccess.h
@@ -313,6 +313,12 @@
sh64 at the moment). */
#define ARCH_KMALLOC_MINALIGN 8
+/*
+ * We want 8-byte alignment for the slab caches as well, otherwise we have
+ * the same BYTES_PER_WORD (sizeof(void *)) min align in kmem_cache_create().
+ */
+#define ARCH_SLAB_MINALIGN 8
+
/* Returns 0 if exception not found and fixup.unit otherwise. */
extern unsigned long search_exception_table(unsigned long addr);
extern const struct exception_table_entry *search_exception_tables (unsigned long addr);
--- orig/mm/slab.c
+++ mod/mm/slab.c
@@ -135,6 +135,10 @@
#define ARCH_KMALLOC_FLAGS SLAB_HWCACHE_ALIGN
#endif
+#ifndef ARCH_SLAB_MINALIGN
+#define ARCH_SLAB_MINALIGN BYTES_PER_WORD
+#endif
+
/* Legal flag mask for kmem_cache_create(). */
#if DEBUG
# define CREATE_MASK (SLAB_DEBUG_INITIAL | SLAB_RED_ZONE | \
@@ -1237,7 +1241,7 @@
while (size <= align/2)
align /= 2;
} else {
- align = BYTES_PER_WORD;
+ align = ARCH_SLAB_MINALIGN;
}
}
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2004-12-05 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-05 18:25 Paul Mundt [this message]
2004-12-05 21:30 Manfred Spraul
2004-12-05 22:20 ` Paul Mundt
2004-12-06 22:15 ` Manfred Spraul
2004-12-06 22:59 ` Paul Mundt
2004-12-12 10:48 ` Manfred Spraul
2004-12-12 15:09 ` Paul Mundt
2004-12-13 21:18 ` Manfred Spraul
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=20041205182554.GB21383@pointless.research.nokia.com \
--to=paul.mundt@nokia.com \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.curnow@st.com \
/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
all inboxes | Powered by JetHome®