Message ID | 20221018152645.3195108-1-nathan@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2020124wrs; Tue, 18 Oct 2022 08:29:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4suV7zbNjjvgjBVzAPqTCgXap4IxZHSL61LHdXO/bEw7qRXVg90DPf2Tht7HL+qjcIMr2D X-Received: by 2002:a05:6402:b5a:b0:458:f4c6:8039 with SMTP id bx26-20020a0564020b5a00b00458f4c68039mr3143088edb.349.1666106950711; Tue, 18 Oct 2022 08:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666106950; cv=none; d=google.com; s=arc-20160816; b=jLg2ZYD4sLIzoNER+Bo6+5MAxdVFIpaLdHsACtbI2aGK6zB1klak2JHnMkE6+ADNbQ /qwtirzSQ7sqFXa9RScSFWnSG7BQJPTGohNSN4XmZlGqsC6JUNIlIIV5Gm6xmyOAhyuL 3Ts8zEZUaDJYRI9B0vw3+Obz0hI1+wOOURuPZVud7Jx/f5pzzYiz2ys1e1G/uFyzxL+/ rn7DsqyV/deAqtLSQgIiZNN1r09E/GKXsLntz3eW3M26TJenfIpzil9NI5P+JzSynlfm U3U+wCFycLSxguI+qM2j5qupsS2lcI5DyZ35P/aTZHCakNXfjt0Lzp80Q8dZL4kUI/lB ZHPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lFFcvFl+0U7wETucj6Hv9a1n5ZlQOQIp41teajtgkBY=; b=GXhyDAcoy7DQFZ9MoTlEXnd+sLWYY1cuE16oBXo3ChS1pe0zRJH8dFTLgYHnmY5c2w PGoK5ykXJUg24Hv5nBdL1Ml948H1/n4m3Rx6l117QcUL8/Rqs21ZqJWqtIrcFWcle4+c hiwFMOLRjXaTeOLqTyw0IIprFH9tUXEwyomVkmVsJEV2mWMrzUisJ1FnWW7N0ON7JGyV TlJKc6s3L7aa84OzwWhjk1Xlcjfthw9TLFXaJukEtLNSoxSeZ3NNeRn9D34jjtoZpooF AS4PlqiOhhQXxZCiA6xRAIUdwkO836fIoRtsLmshpLpRMb9+WFAMB6mn2mwl/H6/2rOc SGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CpLiFvwh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga13-20020a1709070c0d00b0073daf6b44a5si11848043ejc.775.2022.10.18.08.28.45; Tue, 18 Oct 2022 08:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CpLiFvwh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiJRP1f (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Tue, 18 Oct 2022 11:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiJRP1e (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Oct 2022 11:27:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDD0B4885 for <linux-kernel@vger.kernel.org>; Tue, 18 Oct 2022 08:27:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19851615CD for <linux-kernel@vger.kernel.org>; Tue, 18 Oct 2022 15:27:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5B8AC433C1; Tue, 18 Oct 2022 15:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666106852; bh=ndYwEDeqYYf4sJcQ9WB423y7Tx/pDZ5xDnUm1T2vjNg=; h=From:To:Cc:Subject:Date:From; b=CpLiFvwhxFyJUQGrqKFPYaQRniijzGx0jLG31Dy+yGr2tkELrWR415sTtbsx4TTA2 URCcynPkdMHjuB0hEgY6DSKXGUVuEpfBvjq7QT39MIuJz23UlelcqoYEacuPYt/6g6 If/P3tMGCjPT6/SdnDaZXUFRM8Z+VpchrR+LKbCaihSrF4TVksVMoyAsktduG2klHm gcyUbW1nOQXJH0nBOPoelJrEIR/uZQp2i8fE8ZQtG6LU0b4I6yVxzZRt2o5yqHO4H0 zEKczOCamb8aKxGy5Kdmcye/VXvGpY+HF1TM6S7PAXW/ap4x1GsB6PvcnWGe5xtzv6 D7LNE+8Cy6OaA== From: Nathan Chancellor <nathan@kernel.org> To: Andrew Morton <akpm@linux-foundation.org>, Dan Williams <dan.j.williams@intel.com> Cc: Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org> Subject: [PATCH] mm/memremap: Mark folio_span_valid() as __maybe_unused Date: Tue, 18 Oct 2022 08:26:46 -0700 Message-Id: <20221018152645.3195108-1-nathan@kernel.org> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747039762341378819?= X-GMAIL-MSGID: =?utf-8?q?1747039762341378819?= |
Series |
mm/memremap: Mark folio_span_valid() as __maybe_unused
|
|
Commit Message
Nathan Chancellor
Oct. 18, 2022, 3:26 p.m. UTC
When building without CONFIG_DEBUG_VM, clang warns:
mm/memremap.c:495:13: error: function 'folio_span_valid' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static bool folio_span_valid(struct dev_pagemap *pgmap, struct folio *folio,
^
1 error generated.
folio_span_valid() is only used within a instance of VM_WARN_ON_ONCE(),
which evaluates to BUILD_BUG_ON_INVALID() with CONFIG_DEBUG_VM=n, which
ultimately resolves to sizeof(), which is fully resolved at compile
time. Basically, the warning is flagging that folio_span_valid() is
only used in a compile time context and will not be called at run time.
Since this is expected given the configuration, mark folio_span_valid()
as __maybe_unused so that there is no warning.
Fixes: 07108d5bfeeb ("fsdax: introduce pgmap_request_folios()")
Link: https://github.com/ClangBuiltLinux/linux/issues/1739
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I am aware the Fixes SHA is probably not stable but I figured I would
include it anyways.
mm/memremap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
base-commit: f5938bbbb79d48ca167e305c228dccbecea0309e
Comments
Nathan Chancellor wrote: > When building without CONFIG_DEBUG_VM, clang warns: > > mm/memremap.c:495:13: error: function 'folio_span_valid' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] > static bool folio_span_valid(struct dev_pagemap *pgmap, struct folio *folio, > ^ > 1 error generated. > > folio_span_valid() is only used within a instance of VM_WARN_ON_ONCE(), > which evaluates to BUILD_BUG_ON_INVALID() with CONFIG_DEBUG_VM=n, which > ultimately resolves to sizeof(), which is fully resolved at compile > time. Basically, the warning is flagging that folio_span_valid() is > only used in a compile time context and will not be called at run time. > > Since this is expected given the configuration, mark folio_span_valid() > as __maybe_unused so that there is no warning. > > Fixes: 07108d5bfeeb ("fsdax: introduce pgmap_request_folios()") > Link: https://github.com/ClangBuiltLinux/linux/issues/1739 > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > --- > > I am aware the Fixes SHA is probably not stable but I figured I would > include it anyways. This fix looks good to me, but I assume commit-ids are not stable until the patch moves from mm-unstable to mm-stable. Andrew, do I have that right?
On Tue, 18 Oct 2022 10:54:58 -0700 Dan Williams <dan.j.williams@intel.com> wrote: > > --- > > > > I am aware the Fixes SHA is probably not stable but I figured I would > > include it anyways. > > This fix looks good to me, but I assume commit-ids are not stable until > the patch moves from mm-unstable to mm-stable. Andrew, do I have that > right? Yes, mm-unstable hashes change daily. But knowing the title of the patch which needs the fix is quite helpful.
diff --git a/mm/memremap.c b/mm/memremap.c index 53fe30bb79bb..02b796749b72 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -492,8 +492,9 @@ void free_zone_device_page(struct page *page) put_dev_pagemap(page->pgmap); } -static bool folio_span_valid(struct dev_pagemap *pgmap, struct folio *folio, - int nr_folios) +static __maybe_unused bool folio_span_valid(struct dev_pagemap *pgmap, + struct folio *folio, + int nr_folios) { unsigned long pfn_start, pfn_end;