From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Zhang Chujun <zhangchujun@cmss.chinamobile.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, david@redhat.com,
thomas.weissschuh@linutronix.de
Subject: Re: [PATCH] selftest/vm_util: remove unused variables
Date: Wed, 5 Nov 2025 22:16:14 +0000 [thread overview]
Message-ID: <9c08ffec-81fc-47dd-8830-c81b28f4e9e1@lucifer.local> (raw)
In-Reply-To: <20251104062855.2468-1-zhangchujun@cmss.chinamobile.com>
Andrew - can we drop this from mm-new please? It's broken the build.
I get a splurge of linker errors building the mm selftests otherwise:
/usr/bin/ld: /tmp/ccA0DyGC.o: in function `__pagemap_scan_get_categories':
vm_util.c:(.text+0x1e9): undefined reference to `__page_size'
/usr/bin/ld: vm_util.c:(.text+0x2bd): undefined reference to `__page_size'
/usr/bin/ld: /tmp/ccA0DyGC.o: in function `allocate_transhuge':
vm_util.c:(.text+0xb90): undefined reference to `__page_shift'
/usr/bin/ld: vm_util.c:(.text+0xbfe): undefined reference to `__page_shift'
/usr/bin/ld: vm_util.c:(.text+0xc52): undefined reference to `__page_size'
/usr/bin/ld: vm_util.c:(.text+0xc67): undefined reference to `__page_shift'
/usr/bin/ld: vm_util.c:(.text+0xc72): undefined reference to `__page_size'
/usr/bin/ld: vm_util.c:(.text+0xc87): undefined reference to `__page_shift'
/usr/bin/ld: vm_util.c:(.text+0xc9c): undefined reference to `__page_size'
/usr/bin/ld: vm_util.c:(.text+0xcc4): undefined reference to `__page_size'
etc.
The idea that nobody uses these variables is simply false, see vm_util.h in same
directory:
extern unsigned int __page_size;
extern unsigned int __page_shift;
static inline unsigned int psize(void)
{
if (!__page_size)
__page_size = sysconf(_SC_PAGESIZE);
return __page_size;
}
static inline unsigned int pshift(void)
{
if (!__page_shift)
__page_shift = (ffsl(psize()) - 1);
return __page_shift;
}
So this patch just seems to be completely broken?
Thanks, Lorenzo
On Tue, Nov 04, 2025 at 02:28:55PM +0800, Zhang Chujun wrote:
> The global variables __page_size and __page_shift are declared in
> vm_util.c, but they are never used anywhere in the codebase. This
> patch removes them to clean up the source and eliminate dead code.
>
> Signed-off-by: Zhang Chujun <zhangchujun@cmss.chinamobile.com>
>
> diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c
> index 3869e68bb8b5..3983c368edd2 100644
> --- a/tools/testing/selftests/mm/vm_util.c
> +++ b/tools/testing/selftests/mm/vm_util.c
> @@ -17,9 +17,6 @@
> #define STATUS_FILE_PATH "/proc/self/status"
> #define MAX_LINE_LENGTH 500
>
> -unsigned int __page_size;
> -unsigned int __page_shift;
> -
> uint64_t pagemap_get_entry(int fd, char *start)
> {
> const unsigned long pfn = (unsigned long)start / getpagesize();
> --
> 2.50.1.windows.1
>
>
>
>
>
next prev parent reply other threads:[~2025-11-05 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 6:28 Zhang Chujun
2025-11-05 22:16 ` Lorenzo Stoakes [this message]
2025-11-06 10:04 ` David Hildenbrand (Red Hat)
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=9c08ffec-81fc-47dd-8830-c81b28f4e9e1@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=zhangchujun@cmss.chinamobile.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