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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D60DC433F5 for ; Wed, 16 Feb 2022 08:00:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C11B66B0078; Wed, 16 Feb 2022 03:00:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA02F6B007B; Wed, 16 Feb 2022 03:00:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A61466B007D; Wed, 16 Feb 2022 03:00:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 93BAE6B0078 for ; Wed, 16 Feb 2022 03:00:14 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3F6BA8EC0C for ; Wed, 16 Feb 2022 08:00:14 +0000 (UTC) X-FDA: 79147895148.06.5393829 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf10.hostedemail.com (Postfix) with ESMTP id 79DF3C000E for ; Wed, 16 Feb 2022 08:00:13 +0000 (UTC) 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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 79DF3C000E X-Stat-Signature: f4a5bojp4nreqsd94bj8a1h6ma1z5abi X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=jaXSSzyj; dkim=pass header.d=linutronix.de header.s=2020e header.b=cx7+VPwB; spf=pass (imf10.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-HE-Tag: 1644998413-671621 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: 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