From patchwork Tue Oct 16 11:17:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu CASTET X-Patchwork-Id: 1600181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 44383DFFED for ; Tue, 16 Oct 2012 11:19:25 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TO59Z-0000IF-De; Tue, 16 Oct 2012 11:17:41 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TO59R-0000GE-CJ for linux-arm-kernel@lists.infradead.org; Tue, 16 Oct 2012 11:17:37 +0000 Received: by mail-bk0-f49.google.com with SMTP id j4so2652222bkw.36 for ; Tue, 16 Oct 2012 04:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=BEfz6lc6z1lcw/waNrQSJk5Uds9+NxPaF7s/lihpLwc=; b=PGykabKvvYMcK16RSIDsRHy8CRvs0/BU5U80JQJfURMjuHOIzo7R9spSXxCalbF0Nz yoAqruGgOekMk20gzxePPgE5z/D4iVQDueZgqTPWJ0ThDJMNRTi+xg1UtzFp8ehE0Bc/ igGqcoceWpVRBBvWjFoN002vVfKZUzopMwGBE2l4lz2F1/nydkOXjhgQAY/mtiulXvzI 51h65Ky0rvyRAd9nxkPIRPIZSozSbLQra3qnsPF+2ZujvjdbYgv76cFZYzTggifeTeqA N5GtLl7jRyl23hrNsVoYBDFmvyLVjdaAHhq526pYRCNrbHnQy4DuRtPQzqgB43EApXwd ShrQ== Received: by 10.204.3.220 with SMTP id 28mr3929559bko.87.1350386250130; Tue, 16 Oct 2012 04:17:30 -0700 (PDT) Received: from perruche.Parrot.Biz ([46.218.109.82]) by mx.google.com with ESMTPS id gy18sm10272683bkc.4.2012.10.16.04.17.28 (version=SSLv3 cipher=OTHER); Tue, 16 Oct 2012 04:17:29 -0700 (PDT) From: Matthieu CASTET To: "linux-kernel@vger.kernel.org" , 'linux-arm-kernel' Subject: [PATCH] slab : allow SLAB_RED_ZONE and SLAB_STORE_USER to work on arm Date: Tue, 16 Oct 2012 13:17:11 +0200 Message-Id: <1350386231-770-1-git-send-email-matthieu.castet@parrot.com> X-Mailer: git-send-email 1.7.10.4 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (matthieu.castet[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Russell King , Pekka Enberg , Matthieu Castet , Matthieu CASTET X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Matthieu CASTET on cortexA8 (omap3) ralign is 64 and __alignof__(unsigned long long) is 8. So we always disable debug. This patch is based on 5c5e3b33b7cb959a401f823707bee006caadd76e, but fix case were align < sizeof(unsigned long long). Signed-off-by: Matthieu Castet CC: Russell King CC: Pekka Enberg --- mm/slab.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index c685475..8427901 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2462,9 +2462,6 @@ __kmem_cache_create (const char *name, size_t size, size_t align, if (ralign < align) { ralign = align; } - /* disable debug if necessary */ - if (ralign > __alignof__(unsigned long long)) - flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER); /* * 4) Store it. */ @@ -2491,8 +2488,9 @@ __kmem_cache_create (const char *name, size_t size, size_t align, */ if (flags & SLAB_RED_ZONE) { /* add space for red zone words */ - cachep->obj_offset += sizeof(unsigned long long); - size += 2 * sizeof(unsigned long long); + int offset = max(align, sizeof(unsigned long long)); + cachep->obj_offset += offset; + size += offset + sizeof(unsigned long long); } if (flags & SLAB_STORE_USER) { /* user store requires one word storage behind the end of