mm/memremap: Mark folio_span_valid() as __maybe_unused
Subsystems (2)
PATCH 1/1 mm/memremap: Mark folio_span_valid() as __maybe_unused
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.
---
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(-)
mm/memremap.c +3 -2
@@ -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
Signature · 1 line
2.38.0
Quoted 16 lines · Nathan Chancellor
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(structdev_pagemap*pgmap, struct folio *folio,^1 error generated.
folio_span_valid()is only used within a instance ofVM_WARN_ON_ONCE(), which evaluates toBUILD_BUG_ON_INVALID()withCONFIG_DEBUG_VM=n, which ultimately resolves tosizeof(), which is fully resolved at compile time. Basically, the warning is flagging thatfolio_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_unusedso that there is no warning.
Quoted 7 lines
Fixes 07108d5bfeeb ("fsdax: introduce pgmap_request_folios()")Signed-off-by Nathan Chancellor <[email protected]>---
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?
Andrew Morton
maintainerQuoted 8 lines · On Tue, 18 Oct 2022 10:54:58 -0700 Dan Williams <[email protected]>…
Quoted 4 lines
---
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.