From patchwork Fri Feb 13 14:11:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peppe CAVALLARO X-Patchwork-Id: 7006 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1DDBvHB015336 for ; Fri, 13 Feb 2009 13:11:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752710AbZBMNL5 (ORCPT ); Fri, 13 Feb 2009 08:11:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752863AbZBMNL5 (ORCPT ); Fri, 13 Feb 2009 08:11:57 -0500 Received: from eu1sys200aog108.obsmtp.com ([207.126.144.125]:39356 "EHLO eu1sys200aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbZBMNL4 (ORCPT ); Fri, 13 Feb 2009 08:11:56 -0500 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob108.postini.com ([207.126.147.11]) with SMTP ID DSNKSZVxkKvkwNoPUdkVpesATvPnw2l2i67O@postini.com; Fri, 13 Feb 2009 13:11:54 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 61BCEDB0A; Fri, 13 Feb 2009 13:10:58 +0000 (GMT) Received: from mail1.ctn.st.com (mail1.ctn.st.com [164.130.116.128]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D90694C2F8; Fri, 13 Feb 2009 13:11:40 +0000 (GMT) Received: from mdt-dhcp43.ctn.st.com (mdt-dhcp43.ctn.st.com [10.52.139.43]) by mail1.ctn.st.com (MOS 3.8.7a) with ESMTP id CZK70174 (AUTH cavagiu); Fri, 13 Feb 2009 14:11:39 +0100 (CET) Message-ID: <49957F98.50708@st.com> Date: Fri, 13 Feb 2009 15:11:36 +0100 From: Giuseppe CAVALLARO User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Pekka Enberg Cc: Paul Mundt , linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, linux-mm@vger.kernel.org, Christoph Lameter Subject: Re: [PATCH] slab: fix slab flags for archs use alignment larger 64-bit References: <1234461073-23281-1-git-send-email-peppe.cavallaro@st.com> <20090212185640.GA6111@linux-sh.org> <499544AD.3030804@st.com> <84144f020902130122y471dd92em4a72de43a0cfc681@mail.gmail.com> <49954F9A.5020801@st.com> <84144f020902130205x4dc5886l70fe6a695ef050a4@mail.gmail.com> <4995565D.5010105@st.com> In-Reply-To: <4995565D.5010105@st.com> X-Enigmail-Version: 0.95.7 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Giuseppe CAVALLARO wrote: > Pekka Enberg wrote: > >> Hi Giuseppe, >> >> On Fri, Feb 13, 2009 at 12:46 PM, Giuseppe CAVALLARO >> 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 From 86c7fe861b4a6ee7b533a25ce2c506134a7533a8 Mon Sep 17 00:00:00 2001 From: Giuseppe Cavallaro 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 --- 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.