All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: David Wang <00107082@163.com>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Baoquan He <bhe@redhat.com>, Harry Yoo <harry.yoo@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH 1/2] lib/test_vmalloc.c: Use late_initcall() if built-in for init ordering
Date: Tue, 24 Jun 2025 13:42:12 +0200	[thread overview]
Message-ID: <aFqPFPmR1sZQzMS0@pc636> (raw)
In-Reply-To: <5686796f.8f47.197a1310b6d.Coremail.00107082@163.com>

On Tue, Jun 24, 2025 at 05:07:15PM +0800, David Wang wrote:
> 
> At 2025-06-24 02:40:34, "Uladzislau Rezki (Sony)" <urezki@gmail.com> wrote:
> >When the vmalloc test code is compiled as a built-in, use late_initcall()
> >instead of module_init() to defer a vmalloc test execution until most
> >subsystems are up and running.
> >
> >It avoids interfering with components that may not yet be initialized
> >at module_init() time. For example, there was a recent report of memory
> >profiling infrastructure not being ready early enough leading to kernel
> >crash.
> >
> >By using late_initcall() in the built-in case, we ensure the tests are
> >run at a safer point during a boot sequence.
> >
> >Cc: Harry Yoo <harry.yoo@oracle.com>
> >Cc: Suren Baghdasaryan <surenb@google.com>
> >Cc: David Wang <00107082@163.com>
> >Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> >---
> > lib/test_vmalloc.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> >diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
> >index 1b0b59549aaf1..7264781750c96 100644
> >--- a/lib/test_vmalloc.c
> >+++ b/lib/test_vmalloc.c
> >@@ -598,7 +598,11 @@ static int __init vmalloc_test_init(void)
> > 	return IS_BUILTIN(CONFIG_TEST_VMALLOC) ? 0:-EAGAIN;
> > }
> > 
> >+#ifdef MODULE
> > module_init(vmalloc_test_init)
> >+#else
> >+late_initcall(vmalloc_test_init);
> 
> >+#endif
> 
> 
> When MODULE defined,  late_initcall is defined as module_init in ./include/linux/module.h
> I think the MODULE check here is redundant,  (it is clearer though)
> 
That was an idea to use MODULE, because late_initcall is designed not
for module.s It would require the comment then.

--
Uladzislau Rezki


      reply	other threads:[~2025-06-24 11:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 18:40 [PATCH 1/2] lib/test_vmalloc.c: Use late_initcall() if built-in for init ordering Uladzislau Rezki (Sony)
2025-06-23 18:40 ` [PATCH 2/2] lib/test_vmalloc.c: Restrict default test mask to avoid test warnings Uladzislau Rezki (Sony)
2025-06-24  9:34   ` Baoquan He
2025-06-24  8:30 ` [PATCH 1/2] lib/test_vmalloc.c: Use late_initcall() if built-in for init ordering Baoquan He
2025-06-24  9:07 ` David Wang
2025-06-24 11:42   ` Uladzislau Rezki [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=aFqPFPmR1sZQzMS0@pc636 \
    --to=urezki@gmail.com \
    --cc=00107082@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=harry.yoo@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.