[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250421122239.710f5d63487853556cb8f57e@linux-foundation.org>
Date: Mon, 21 Apr 2025 12:22:39 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: "Lance Yang" <lance.yang@...ux.dev>
Cc: "David Hildenbrand" <david@...hat.com>, mingzhe.yang@...com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, "Lance Yang"
<ioworker0@...il.com>
Subject: Re: [RESEND PATCH v2 1/1] mm/rmap: add CONFIG_MM_ID guard for
folio_test_large_maybe_mapped_shared()
On Mon, 21 Apr 2025 05:13:03 +0000 "Lance Yang" <lance.yang@...ux.dev> wrote:
> > Can we just slap "#ifdef CONFIG_MM_ID" around the whole function? It
> >
> > should have no callers, right? If the linker ends up complaining then
> >
> > something went wrong.
>
> The reason we can't simply add #ifdef CONFIG_MM_ID around folio_test_large_maybe_mapped_shared()
> is because its caller folio_maybe_mapped_shared() relies on IS_ENABLED(CONFIG_MM_ID).
>
> If we do, with CONFIG_TRANSPARENT_HUGEPAGE=N, we'll hit compilation errors like:
>
> ./include/linux/mm.h: In function ‘folio_maybe_mapped_shared’:
> ./include/linux/mm.h:2337:16: error: implicit declaration of function ‘folio_test_large_maybe_mapped_shared’; did you mean ‘folio_maybe_mapped_shared’? [-Werror=implicit-function-declaration]
> 2337 | return folio_test_large_maybe_mapped_shared(folio);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | folio_maybe_mapped_shared
> cc1: some warnings being treated as errors
That's OK - provide a declaration of folio_maybe_mapped_shared() but no
definition. So the compiled-out code can be compiled and the linker
will confirm that it's never actually called.
Powered by blists - more mailing lists