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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED 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 DDBDDC47080 for ; Wed, 2 Jun 2021 01:03:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 857BE613C3 for ; Wed, 2 Jun 2021 01:03:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 857BE613C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C964F6B006C; Tue, 1 Jun 2021 21:03:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C46A86B006E; Tue, 1 Jun 2021 21:03:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE6D26B0070; Tue, 1 Jun 2021 21:03:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id 76F786B006C for ; Tue, 1 Jun 2021 21:03:11 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 041EA180AD80F for ; Wed, 2 Jun 2021 01:03:11 +0000 (UTC) X-FDA: 78206984982.26.A99B55B Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by imf26.hostedemail.com (Postfix) with ESMTP id 1285E4202A08 for ; Wed, 2 Jun 2021 01:03:03 +0000 (UTC) Received: by mail-oi1-f177.google.com with SMTP id j1so1162760oie.6 for ; Tue, 01 Jun 2021 18:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=6v4d48Zss5FUokcaaUtSt3kui+BNXg1BXI8kRVyRFLk=; b=LtN3231NVNq0mXT34pbs0UuC74vsdSIC+1A9r+79atUSmriT/q2OLfkAhm5aur3USF injadBILLKRZLH8VWLoRib5ugueg457K5frQigf8OGAOl8NI5LOOdl+jHSA67gElje+L neMMZL6Rk4kG2Hyz+Ib/Dc/JhVLSr2KEBekWI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=6v4d48Zss5FUokcaaUtSt3kui+BNXg1BXI8kRVyRFLk=; b=kIPU7kMrwYizk+PY9AKi0j6NV8RsnijzSlrfFhEgNESKeQzcBhh+s4Yhuf+GueG97+ /WqQvWhls+iBp6LH0r9iK5I249NwhhpvmxDRsMIoXqbcq2UCQxwc4i8/71Z28kxpKc/5 ve5b3u+9Fg8kV8gsl/oP9JJjHwbWd5ooa6CA+HpcQnOCGOxzxfWSNi14CPBemiEVTX/D V4TMjrDTIb3XoqtpYRZ2XFiw3lcIjv+i2dvhIHUp/qu6Kn2PvgoRRFdbiBHDVISQSINa CcN8YtIR2TYn6dboNqj94MZrOsfGCG2bm/aTy+uQ4CjjRpH2KQv0cP9JbuhEehiJf7a0 fRlw== X-Gm-Message-State: AOAM530M+51x/NEFJEmu7G/cdvKDDTOVBibmoEVgj/ELH0dO3a0ad8vD fQ6dgQDzpdMReL2XWm/p5XDR2zd0KtDZzB5wBriMDg== X-Google-Smtp-Source: ABdhPJx6nDBP7InIFQYnGr+qlRC/3IhaDQEHA4xty1JZiAIex11jLAGNCc2LjHVj8tfVR+scGQ9IUXtDaweG/6f6QJU= X-Received: by 2002:a05:6808:144e:: with SMTP id x14mr2045245oiv.166.1622595789856; Tue, 01 Jun 2021 18:03:09 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 1 Jun 2021 18:03:09 -0700 MIME-Version: 1.0 In-Reply-To: <20210601172659.fd8c40a6548a1bd43be1bf11@linux-foundation.org> References: <20210601182202.3011020-5-swboyd@chromium.org> <202106020644.UDFIJOUU-lkp@intel.com> <20210601172659.fd8c40a6548a1bd43be1bf11@linux-foundation.org> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Tue, 1 Jun 2021 18:03:09 -0700 Message-ID: Subject: Re: [PATCH v3 4/4] slub: Force on no_hash_pointers when slub_debug is enabled To: Andrew Morton , kernel test robot Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, Linux Memory Management List , linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Petr Mladek , Joe Perches Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=LtN3231N; spf=pass (imf26.hostedemail.com: domain of swboyd@chromium.org designates 209.85.167.177 as permitted sender) smtp.mailfrom=swboyd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1285E4202A08 X-Stat-Signature: 69onr1w91s4ysjczxhsxgbns9ntdpgeh X-HE-Tag: 1622595783-234119 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Quoting Andrew Morton (2021-06-01 17:26:59) > On Wed, 2 Jun 2021 06:45:55 +0800 kernel test robot wrote: > > > >> mm/slub.c:4464:30: error: use of undeclared identifier 'slub_debug_enabled' > > if (static_branch_unlikely(&slub_debug_enabled)) > > ^ > > >> mm/slub.c:4464:30: error: use of undeclared identifier 'slub_debug_enabled' > > >> mm/slub.c:4464:30: error: use of undeclared identifier 'slub_debug_enabled' > > >> mm/slub.c:4464:30: error: use of undeclared identifier 'slub_debug_enabled' > > >> mm/slub.c:4464:6: error: invalid argument type 'void' to unary expression > > if (static_branch_unlikely(&slub_debug_enabled)) > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Thanks. Stephen, how about this? Looks good to me. Thanks for the quick fix! > > --- a/mm/slub.c~slub-force-on-no_hash_pointers-when-slub_debug-is-enabled-fix > +++ a/mm/slub.c > @@ -117,12 +117,26 @@ > */ > > #ifdef CONFIG_SLUB_DEBUG > + > #ifdef CONFIG_SLUB_DEBUG_ON > DEFINE_STATIC_KEY_TRUE(slub_debug_enabled); > #else > DEFINE_STATIC_KEY_FALSE(slub_debug_enabled); > #endif > -#endif > + > +static inline bool __slub_debug_enabled(void) > +{ > + return static_branch_unlikely(&slub_debug_enabled); To make this even better it could be return static_branch_maybe(CONFIG_SLUB_DEBUG_ON, &slub_debug_enabled); > +} > + > +#else /* CONFIG_SLUB_DEBUG */ > + > +static inline bool __slub_debug_enabled(void) > +{ > + return false; > +} > + > +#endif /* CONFIG_SLUB_DEBUG */ > > static inline bool kmem_cache_debug(struct kmem_cache *s) > { > @@ -4493,7 +4507,7 @@ void __init kmem_cache_init(void) > slub_max_order = 0; > > /* Print slub debugging pointers without hashing */ > - if (static_branch_unlikely(&slub_debug_enabled)) > + if (__slub_debug_enabled()) It would be super cool if static branches could be optimized out when they're never changed by any code, nor exported to code, just tested in conditions. I've no idea if that is the case though. > no_hash_pointers_enable(NULL); > > kmem_cache_node = &boot_kmem_cache_node;