From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbdKHPFP (ORCPT ); Wed, 8 Nov 2017 10:05:15 -0500 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:35236 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752021AbdKHPFO (ORCPT ); Wed, 8 Nov 2017 10:05:14 -0500 Date: Wed, 8 Nov 2017 09:05:12 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Miles Chen cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, wsd_upstream@mediatek.com, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] slub: Fix sysfs duplicate filename creation when slub_debug=O In-Reply-To: <1510119138.17435.19.camel@mtkswgap22> Message-ID: References: <1510023934-17517-1-git-send-email-miles.chen@mediatek.com> <1510119138.17435.19.camel@mtkswgap22> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfIklR98fdY5i0OKVhfH2ea7l4PAFimOdNj4kXvUmbp0E66CTbspgTJyrd5l3fzSEUa3/5jBGpkLs5+7/sVudht9MEQ8aKC/XeOz+KSX28ZCMRHHoWElM MhaFQL+XVpcTwvf1gmqobZsHx8kSkba+Az2uMyfHzkCcwDtLAl124C+0EXNf21n0vm9+XHPESyO0IislLTDWbbsud0kHi1dIjLo9MvqMQczMzOZRn8+uXbVO NUjleWIkMlf2te12IX0IWpczTcytt1sr+rP4FHHTW4CasI2boIQ2ViP94LC0SlpE4x0sE8iyGO2Gvlmc2+X/J3+QGYFfk06LPSWsYoF6Uqv8bcaoRTtlQ7qA oaIEyh3uW6o64i1QA54RFwToucPAK9XDL6PdwBf1DQMfJysHfkjcECMB4JHIS6weFSo/NMY7fFdq9w6Fi44U6rqGO4aJvZ+ibWNojBeGqFAlYsdOw8Q= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Nov 2017, Miles Chen wrote: > > Ok then the aliasing failed for some reason. The creation of the unique id > > and the alias detection needs to be in sync otherwise duplicate filenames > > are created. What is the difference there? > > The aliasing failed because find_mergeable() returns if (flags & > SLAB_NEVER_MERGE) is true. So we do not go to search for alias caches. > > __kmem_cache_alias() > find_mergeable() > kmem_cache_flags() --> setup flag by the slub_debug > if (flags & SLAB_NEVER_MERGE) return NULL; > ... > search alias logic... > > > The flags maybe changed if disable_higher_order_debug=1. So the > unmergeable cache becomes mergeable later. Ok so make sure taht the aliasing logic also clears those flags before checking for SLAB_NEVER_MERGE. > > The clearing of the DEBUG_METADATA_FLAGS looks ok to me. kmem_cache_alias > > should do the same right? > > > Yes, I think clearing DEBUG_METADATA flags in kmem_cache_alias is > another solution for this issue. > > We will need to do calculate_sizes() by using original flags and compare > the order of s->size and s->object_size when > disable_higher_order_debug=1. Hmmm... Or move the aliasing check to a point where we know the size of the slab objects?