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 [thread overview]
Message-ID: <20221018152645.3195108-1-nathan@kernel.org> (raw)
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(-)
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;
base-commit: f5938bbbb79d48ca167e305c228dccbecea0309e
--
2.38.0
next reply other threads:[~2022-10-18 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 15:26 Nathan Chancellor [this message]
2022-10-18 17:54 ` Dan Williams
2022-10-18 20:55 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221018152645.3195108-1-nathan@kernel.org \
--to=nathan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=trix@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox