[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250420162925.2c58c018defee9ee192be553@linux-foundation.org>
Date: Sun, 20 Apr 2025 16:29:25 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Lance Yang <ioworker0@...il.com>
Cc: mingzhe.yang@...com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
David Hildenbrand <david@...hat.com>, Lance Yang <lance.yang@...ux.dev>
Subject: Re: [RESEND PATCH v2 1/1] mm/rmap: add CONFIG_MM_ID guard for
folio_test_large_maybe_mapped_shared()
On Fri, 18 Apr 2025 23:22:28 +0800 Lance Yang <ioworker0@...il.com> wrote:
> From: Lance Yang <lance.yang@...ux.dev>
>
> To prevent folio_test_large_maybe_mapped_shared() from being used without
> CONFIG_MM_ID, we add a compile-time check rather than wrapping it in
> '#ifdef', avoiding even more #ifdef in callers that already use
> IS_ENABLED(CONFIG_MM_ID).
>
> Also, we used plenty of IS_ENABLED() on purpose to keep the code free of
> '#ifdef' mess.
I dunno, this just seems really whacky.
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -1232,6 +1232,8 @@ static inline int folio_has_private(const struct folio *folio)
>
> static inline bool folio_test_large_maybe_mapped_shared(const struct folio *folio)
> {
> + /* This function should never be called without CONFIG_MM_ID enabled. */
A correcter comment would be "This function should never be compiled
without CONFIG_MM_ID enabled".
Which lets the cat out of the bag. Why the heck is it being compiled
with CONFIG_MM_ID=n?? We have tools to prevent that.
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.
Powered by blists - more mailing lists