Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893AbbGNNRX (ORCPT ); Tue, 14 Jul 2015 09:17:23 -0400 Received: from forward-corp1m.cmail.yandex.net ([5.255.216.100]:58917 "EHLO forward-corp1m.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746AbbGNNRK (ORCPT ); Tue, 14 Jul 2015 09:17:10 -0400 Authentication-Results: smtpcorp4.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 2/2] mm/slub: disable merging after enabling debug in runtime From: Konstantin Khlebnikov To: linux-mm@kvack.org, Christoph Lameter Cc: Andrew Morton , linux-kernel@vger.kernel.org Date: Tue, 14 Jul 2015 16:17:05 +0300 Message-ID: <20150714131705.21442.99279.stgit@buzz> In-Reply-To: <20150714131704.21442.17939.stgit@buzz> References: <20150714131704.21442.17939.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2972 Lines: 99 Enabling debug in runtime breaks creation of new kmem caches: they have incompatible flags thus cannot be merged but unique names are taken by existing caches. Signed-off-by: Konstantin Khlebnikov --- mm/slab.h | 2 ++ mm/slab_common.c | 2 +- mm/slub.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index 8da63e4e470f..c8998f1d270f 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -66,6 +66,8 @@ extern struct list_head slab_caches; /* The slab cache that manages slab cache information */ extern struct kmem_cache *kmem_cache; +extern int slab_nomerge; + unsigned long calculate_alignment(unsigned long flags, unsigned long align, unsigned long size); diff --git a/mm/slab_common.c b/mm/slab_common.c index 3e5f8f29c286..eae96f0e7f29 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -44,7 +44,7 @@ struct kmem_cache *kmem_cache; * Merge control. If this is set then no merging of slab caches will occur. * (Could be removed. This was introduced to pacify the merge skeptics.) */ -static int slab_nomerge; +int slab_nomerge __read_mostly; static int __init setup_slab_nomerge(char *str) { diff --git a/mm/slub.c b/mm/slub.c index 4497cae6a914..94300ced4c96 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4610,6 +4610,7 @@ static ssize_t sanity_checks_store(struct kmem_cache *s, if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; s->flags |= SLAB_DEBUG_FREE; + slab_nomerge = 1; } return length; } @@ -4635,6 +4636,7 @@ static ssize_t trace_store(struct kmem_cache *s, const char *buf, if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; s->flags |= SLAB_TRACE; + slab_nomerge = 1; } return length; } @@ -4655,6 +4657,7 @@ static ssize_t red_zone_store(struct kmem_cache *s, if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; s->flags |= SLAB_RED_ZONE; + slab_nomerge = 1; } calculate_sizes(s, -1); return length; @@ -4676,6 +4679,7 @@ static ssize_t poison_store(struct kmem_cache *s, if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; s->flags |= SLAB_POISON; + slab_nomerge = 1; } calculate_sizes(s, -1); return length; @@ -4697,6 +4701,7 @@ static ssize_t store_user_store(struct kmem_cache *s, if (buf[0] == '1') { s->flags &= ~__CMPXCHG_DOUBLE; s->flags |= SLAB_STORE_USER; + slab_nomerge = 1; } calculate_sizes(s, -1); return length; @@ -4752,8 +4757,10 @@ static ssize_t failslab_store(struct kmem_cache *s, const char *buf, return -EINVAL; s->flags &= ~SLAB_FAILSLAB; - if (buf[0] == '1') + if (buf[0] == '1') { s->flags |= SLAB_FAILSLAB; + slab_nomerge = 1; + } return length; } SLAB_ATTR(failslab); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/