Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp629911pxb; Wed, 16 Feb 2022 00:20:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzY2y9O2A7VGG7j90XHKZ3GT1dk/H8W0QHDzkq9jEo+fG1LXSDwOJ3OSAw/TMzUlMyronI X-Received: by 2002:a17:902:ccc1:b0:14d:964b:618b with SMTP id z1-20020a170902ccc100b0014d964b618bmr1426505ple.13.1644999621734; Wed, 16 Feb 2022 00:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644999621; cv=none; d=google.com; s=arc-20160816; b=J4rzfwfykg380zIDthEj9oruavTW+rfBczmtSKh6scrjKEwrsIQfXFMm2PGL0x42+0 X5zulb0JGpf4B81okfpIHJysKP6LwTV06oXWrHeFrjlBibkmVvVwQmHwiIrsS7E+BKep b7mqINcbdxhNkn2le18z9hx+pZbfU5ve+A6FpKSgVwE6GJ1BPAJwtCFHVPynUG97jqbu RnBUEdsFifYicXG0Qsf/JdL+oM77hmHF2glt72OQxGl/4jO0t14RfIhzybrgz1eRIEmf 66t0bUztp/ZnrJR42UQyiJeCexsZxpoAVr2Hce7nh6ofjz6dJoFLxATbU4dwxBwWzIxo JvYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=L3wE8zC2jYkj5x3k+oWAafJ5133fm1wlh+aJZav8UAA=; b=R7oe+3NfkRUZXKz7Ve1pZGIe/elVEe5gi/1QEDRa2eYn70OJRoPsWA+QzOqO6kAt5y zHhihrwMADhfyf1nv/8LTy2PDtI5R7RYXKxvHIMxswmNR/3CAZzEIvMFzF+2vxa9Dk45 tpv95RuEpXF1rCLJ96MwB9H2RYwzH1adX6UbuGkTq5PtBggolA2PSeZzxdAEmvdVkY4j fOcKXf/Y2AdguGVK+OR1NfFfs7TzrSF9Ok4wfDNbodCfFq9YIdNR46KnD2odf0xSPWMV xgoGoDsohHDtfzXNXZr5OyseXaKHgUXF0aWDXQBqN1wxT3mirQzd0OWxkOp/tn2wlLz1 Q4bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jaXSSzyj; dkim=neutral (no key) header.i=@linutronix.de header.b=cx7+VPwB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 26si4794283pgw.789.2022.02.16.00.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 00:20:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jaXSSzyj; dkim=neutral (no key) header.i=@linutronix.de header.b=cx7+VPwB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 457AC20602A; Wed, 16 Feb 2022 00:00:19 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbiBPIA0 (ORCPT + 99 others); Wed, 16 Feb 2022 03:00:26 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:49470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbiBPIAY (ORCPT ); Wed, 16 Feb 2022 03:00:24 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED16812F158 for ; Wed, 16 Feb 2022 00:00:12 -0800 (PST) Date: Wed, 16 Feb 2022 09:00:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1644998411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L3wE8zC2jYkj5x3k+oWAafJ5133fm1wlh+aJZav8UAA=; b=jaXSSzyje7OAjBr0pNyS0kC9631YB1d0r1xiJeJPjaji5U2NKpyppIrJV5amnFvQkcYG9Q 8d0SSRbXsJAOSdUb89yBAfAS4FfeX5DSV/GCIQKXw2q6KKwkyRoq8lOlfMMew4LXLA+OCO Cp2N/xN6XosIIIT78a+yaNDYInxTNZ/9JiJ/uJC+n30MVenmAMOt6mQgywm7LKqwjG7Qh0 2YjthQae5zOy9x/vGdYHMP/akgtArO8bY4pyPDFkJ5QURwqR9oUcSVhIhCHe6vE0BSlguK WI5xR4MGgO1OKhrm+rKXMoOw5dLg5JWT2D09F2WC4s1ozE6QDTPKpFfpySqCMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1644998411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L3wE8zC2jYkj5x3k+oWAafJ5133fm1wlh+aJZav8UAA=; b=cx7+VPwBYMo2YklIKj2fj9LIDfDAb3Ai+sBh0/4P+3PYdLJawOMwiPIaYrG+cdU1BBB3iR JJd8W0dzCP+bV5AQ== From: Sebastian Andrzej Siewior To: Nathan Chancellor Cc: Andrew Morton , Peter Zijlstra , Nick Desaulniers , linux-mm@kvack.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, "kernelci.org bot" Subject: Re: [PATCH] mm/page_alloc: Mark pagesets as __maybe_unused Message-ID: References: <20220215184322.440969-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220215184322.440969-1-nathan@kernel.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-02-15 11:43:22 [-0700], Nathan Chancellor wrote: > Commit 9983a9d577db ("locking/local_lock: Make the empty local_lock_*() > function a macro.") in the -tip tree converted the local_lock_*() > functions into macros, which causes a warning with clang with > CONFIG_PREEMPT_RT=n + CONFIG_DEBUG_LOCK_ALLOC=n: > > mm/page_alloc.c:131:40: error: variable 'pagesets' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] > static DEFINE_PER_CPU(struct pagesets, pagesets) = { > ^ > 1 error generated. > > Prior to that change, clang was not able to tell that pagesets was > unused in this configuration because it does not perform cross function > analysis in the frontend. After that change, it sees that the macros > just do a typecheck on the lock member of pagesets, which is evaluated > at compile time (so the variable is technically "used"), meaning the > variable is not needed in the final assembly, as the warning states. > > Mark the variable as __maybe_unused to make it clear to clang that this > is expected in this configuration so there is no more warning. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1593 > Reported-by: "kernelci.org bot" > Suggested-by: Nick Desaulniers > Signed-off-by: Nathan Chancellor > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 7ff1efc84205..406f5d0c610f 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -128,7 +128,7 @@ static DEFINE_MUTEX(pcp_batch_high_lock); > struct pagesets { > local_lock_t lock; > }; > -static DEFINE_PER_CPU(struct pagesets, pagesets) = { > +static DEFINE_PER_CPU(struct pagesets, pagesets) __maybe_unused = { No, I need to think of something else then for the local_lock thing. I haven't seen it with gcc. There is probably more than just this one. > .lock = INIT_LOCAL_LOCK(lock), > }; Sebastian