From: Zenghui Yu <zenghui.yu@linux.dev>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
shuah@kernel.org, gourry@gourry.net
Subject: Re: [PATCH v2 3/3] selftests/mm: init page sizes early in pagemap_ioctl test
Date: Fri, 18 Sep 2026 14:59:53 +0800 [thread overview]
Message-ID: <fa0bdb5c-3903-44bf-8d14-91d77e32b201@linux.dev> (raw)
In-Reply-To: <b1f2a146-1a61-42bd-98c5-fc4380b6ae49@kernel.org>
Hi David,
On 9/16/26 11:30 PM, David Hildenbrand (Arm) wrote:
> On 9/8/26 15:44, Zenghui Yu wrote:
> > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
> >
> > Initialize page_size and hpage_size before calling init_uffd(),
> > hugetlb_setup_default(), etc. That won't fix anything, but it is safer and
> > saner to get these globals set up before doing other things.
> >
> > While at it, drop the page_size parameter of transact_test(), which is
> > actually unnecessary.
> >
> > Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
> > ---
> > tools/testing/selftests/mm/pagemap_ioctl.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c
> > index 1a87b7483316..d9a4fb782ecf 100644
> > --- a/tools/testing/selftests/mm/pagemap_ioctl.c
> > +++ b/tools/testing/selftests/mm/pagemap_ioctl.c
> > @@ -1489,7 +1489,7 @@ static void *thread_proc(void *mem)
> > return NULL;
> > }
> >
> > -static void transact_test(int page_size)
> > +static void transact_test(void)
> > {
> > unsigned int i, count, extra_pages;
> > unsigned int c;
> > @@ -1653,6 +1653,9 @@ int main(int __attribute__((unused)) argc, char *argv[])
> >
> > ksft_print_header();
> >
> > + page_size = getpagesize();
> > + hpage_size = read_pmd_pagesize();
> > +
> > if (init_uffd())
> > ksft_exit_skip("Failed to initialize userfaultfd\n");
> >
> > @@ -1661,9 +1664,6 @@ int main(int __attribute__((unused)) argc, char *argv[])
> >
> > ksft_set_plan(119);
> >
> > - page_size = getpagesize();
> > - hpage_size = read_pmd_pagesize();
> > -
> We have some other code rework that part, so I expect some conflicts for whoever
> goes in first.
>
> Why not
>
> initialize them right when defining the variables, marking them const?
I'm afraid I don't quite understand your suggestion. page_size and
hpage_size are static global variables which cannot be initialized at their
definition. What am I missing?
Thanks,
Zenghui
prev parent reply other threads:[~2026-09-18 7:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 13:41 [PATCH v2 0/3] selftests/mm: pagemap_ioctl test fixes and cleanups Zenghui Yu
2026-09-08 13:41 ` [PATCH v2 1/3] selftests/mm: fix size truncation in pagemap_ioctl test Zenghui Yu
2026-09-16 15:26 ` David Hildenbrand (Arm)
2026-09-08 13:43 ` [PATCH v2 2/3] selftests/mm: mark file-local symbols of pagemap_ioctl.c static Zenghui Yu
2026-09-16 15:27 ` David Hildenbrand (Arm)
2026-09-08 13:44 ` [PATCH v2 3/3] selftests/mm: init page sizes early in pagemap_ioctl test Zenghui Yu
2026-09-08 13:50 ` Zenghui Yu
2026-09-16 15:30 ` David Hildenbrand (Arm)
2026-09-18 6:59 ` Zenghui Yu [this message]
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=fa0bdb5c-3903-44bf-8d14-91d77e32b201@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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
all inboxes | Powered by JetHome®