From: William Pierce <wgpierce17@gmail.com>
To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu
Cc: alex@ghiti.fr, linux-riscv@lists.infradead.org
Subject: [BUG] Module load relocation hashtable size can become huge and unallocatable
Date: Sun, 30 Mar 2025 13:12:48 -0700 [thread overview]
Message-ID: <32a55bf7-ffc7-4383-ab61-fd4d75f46b3a@gmail.com> (raw)
Hello, I have a kernel module that requires a huge number
of relocations upon loading.
On other architectures, it loads into the kernel just fine.
However, on riscv, while allocating memory for its relocation
hashtable, it ends up requesting 2097152 elements to kmalloc_array.
Right here I've dumped the values by recompiling the kernel:
num_relocations: 1630985, hastable_size: 2097152
https://elixir.bootlin.com/linux/v6.14-rc6/source/arch/riscv/kernel/module.c#L734
which kmalloc_array->...->___kmalloc_large_node->...->
__alloc_frozen_pages_noprof can't handle and returns
"Cannot allocate memory" on insmod.
How would it be recommended to fix this?
I could imagine allocating a more discontiguous data structure
to track the relocations or otherwise reworking the tracking to
do the relocation tracking inline.
Thank you,
Will Pierce
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2025-03-30 20:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-30 20:12 William Pierce [this message]
2025-04-01 3:10 ` [BUG] Module load relocation hashtable size can become huge and unallocatable William Pierce
2025-04-01 7:55 ` Clément Léger
2025-04-01 21:00 ` William Pierce
2025-04-02 5:34 ` [PATCH] riscv: Use kvmalloc_array on relocation_hashtable wgpierce17
2025-04-02 6:56 ` Alexandre Ghiti
2025-04-02 8:12 ` William Pierce
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=32a55bf7-ffc7-4383-ab61-fd4d75f46b3a@gmail.com \
--to=wgpierce17@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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