From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B1D6C433B4 for ; Wed, 12 May 2021 20:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2ED9861408 for ; Wed, 12 May 2021 20:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386075AbhELUTO (ORCPT ); Wed, 12 May 2021 16:19:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:58130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378528AbhELT30 (ORCPT ); Wed, 12 May 2021 15:29:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F240261289; Wed, 12 May 2021 19:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620847698; bh=6iFH/7DBOnYgqfe5St6V+48YFQ+dajzUksv+xrkUsXM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NABkE1qMrTm5hp+DTiRo3TkpP2G4mkyJttSzMR8Y22LiC01HWyuV05dDqK/ewus3n dd6VOaD5aNtSQURQ8kRp9uz1m5Cc/Ra0UbiJmiXhAcIXiJ7GVgtEZPm16Um0joOpTL XPrEGyluk73evRvFoArqhcPZDsYKj2ZA4OdhpuiZPFcjb9hdIXb9mDV0NcuBnx/97O dsNeaIj671PKGTfr1d8+6iq5tuVmZHMwBwWzUAZm0+C5ukgFKFQWZdaNDqaxdbkude tCrKDhCaSCkjw3MNqG4XbQV7l9mdkWigOI8vBURPgKLVn88AJbe8nb9decD16ghGaH UBn/jWgWOOJqg== Date: Wed, 12 May 2021 15:28:16 -0400 From: Sasha Levin To: Vlastimil Babka Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Oliver Glitta , David Rientjes , Christoph Lameter , Pekka Enberg , Joonsoo Kim , "Paul E. McKenney" , Andrew Morton , Linus Torvalds Subject: Re: [PATCH 5.10 518/530] mm, slub: enable slub_debug static key when creating cache with explicit debug flags Message-ID: References: <20210512144819.664462530@linuxfoundation.org> <20210512144836.780038842@linuxfoundation.org> <003ce4ee-304c-68cb-6871-cf01495438b6@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <003ce4ee-304c-68cb-6871-cf01495438b6@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 07:25:24PM +0200, Vlastimil Babka wrote: >On 5/12/21 5:50 PM, Greg Kroah-Hartman wrote: >> On Wed, May 12, 2021 at 05:35:28PM +0200, Vlastimil Babka wrote: >>> On 5/12/21 4:50 PM, Greg Kroah-Hartman wrote: >>> > From: Vlastimil Babka >>> > >>> > [ Upstream commit 1f0723a4c0df36cbdffc6fac82cd3c5d57e06d66 ] >>> > >>> > Commit ca0cab65ea2b ("mm, slub: introduce static key for slub_debug()") >>> > introduced a static key to optimize the case where no debugging is >>> > enabled for any cache. The static key is enabled when slub_debug boot >>> > parameter is passed, or CONFIG_SLUB_DEBUG_ON enabled. >>> > >>> > However, some caches might be created with one or more debugging flags >>> > explicitly passed to kmem_cache_create(), and the commit missed this. >>> > Thus the debugging functionality would not be actually performed for >>> > these caches unless the static key gets enabled by boot param or config. >>> > >>> > This patch fixes it by checking for debugging flags passed to >>> > kmem_cache_create() and enabling the static key accordingly. >>> > >>> > Note such explicit debugging flags should not be used outside of >>> > debugging and testing as they will now enable the static key globally. >>> > btrfs_init_cachep() creates a cache with SLAB_RED_ZONE but that's a >>> > mistake that's being corrected [1]. rcu_torture_stats() creates a cache >>> > with SLAB_STORE_USER, but that is a testing module so it's OK and will >>> > start working as intended after this patch. >>> > >>> > Also note that in case of backports to kernels before v5.12 that don't >>> > have 59450bbc12be ("mm, slab, slub: stop taking cpu hotplug lock"), >>> > static_branch_enable_cpuslocked() should be used. >>> > >>> > [1] https://lore.kernel.org/linux-btrfs/20210315141824.26099-1-dsterba@suse.com/ >>> > >>> > Link: https://lkml.kernel.org/r/20210315153415.24404-1-vbabka@suse.cz >>> > Fixes: ca0cab65ea2b ("mm, slub: introduce static key for slub_debug()") >>> > Signed-off-by: Vlastimil Babka >>> > Reported-by: Oliver Glitta >>> > Acked-by: David Rientjes >>> > Cc: Christoph Lameter >>> > Cc: Pekka Enberg >>> > Cc: Joonsoo Kim >>> > Cc: "Paul E. McKenney" >>> > Signed-off-by: Andrew Morton >>> > Signed-off-by: Linus Torvalds >>> > Signed-off-by: Sasha Levin >>> >>> Uh, rather not release this to stable without the followup fix: >>> https://lore.kernel.org/linux-mm/20210504120019.26791-1-vbabka@suse.cz/ >> >> Is that in Linus's tree yet? If so, what is the git id? > >No, it's in mmotm, so no git id yet, but should make it to Linus during 5.13 rc's. I'll drop it for now, thanks! -- Thanks, Sasha