From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755488AbdKIXv6 (ORCPT ); Thu, 9 Nov 2017 18:51:58 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:62134 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755031AbdKIXv4 (ORCPT ); Thu, 9 Nov 2017 18:51:56 -0500 X-UUID: 00d23a122d6e46f2af28fb33409f17ae-20171110 Message-ID: <1510271512.11555.3.camel@mtkswgap22> Subject: Re: [PATCH] slub: Fix sysfs duplicate filename creation when slub_debug=O From: Miles Chen To: Christopher Lameter CC: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , , , , Date: Fri, 10 Nov 2017 07:51:52 +0800 In-Reply-To: References: <1510023934-17517-1-git-send-email-miles.chen@mediatek.com> <1510119138.17435.19.camel@mtkswgap22> <1510217554.32371.17.camel@mtkswgap22> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-11-09 at 09:49 -0600, Christopher Lameter wrote: > On Thu, 9 Nov 2017, Miles Chen wrote: > > > In this fix patch, it disables slab merging if SLUB_DEBUG=O and > > CONFIG_SLUB_DEBUG_ON=y but the debug features are disabled by the > > disable_higher_order_debug logic and it holds the "slab merging is off > > if any debug features are enabled" behavior. > > Sounds good. Where is the patch? > > Sorry for confusing, I meant the original patch of this thread :-) By checking disable_higher_order_debug & (slub_debug & SLAB_NEVER_MERGE), we can detect if a cache is unmergeable but become mergeable because the disable_higher_order_debug=1 logic. Those kind of caches should be keep unmergeable. diff --git a/mm/slub.c b/mm/slub.c index 1efbb812..8cbf9f7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5704,6 +5704,10 @@ static int sysfs_slab_add(struct kmem_cache *s) return 0; } + if (!unmergeable && disable_higher_order_debug && + (slub_debug & SLAB_NEVER_MERGE)) + unmergeable = 1; + if (unmergeable) { /* * Slabcache can never be merged so we can use the name proper.