Increase the maximum size allowed for kernel modules

General support questions
Post Reply
jamm007
Posts: 1
Joined: 2012/02/21 14:59:43

Increase the maximum size allowed for kernel modules

Post by jamm007 » 2012/02/21 15:55:39

I want install a module kernel ( arround 80 Mb) in a machine with CentOS 6.0.

When I try it jumps this error: "insmod: error inserting '/usr/local/lib/click.ko': -1 Cannot allocate memory".

After investigating, I come to the conclusion that machine cannot install a module kernel bigger than 64 Mb.

Some ideas how increase the maximum size allowed in memory for kernel modules?

Thank's

Jorge

NedSlider
Forum Moderator
Posts: 2897
Joined: 2005/10/28 13:11:50
Location: UK

Increase the maximum size allowed for kernel modules

Post by NedSlider » 2012/02/21 18:54:27

What does dmesg say?

NedSlider
Forum Moderator
Posts: 2897
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Post by NedSlider » 2012/02/21 19:04:32

Where does click.ko come from, and more importantly was it compiled against the kernel into which you are trying to load it?

What documentation do you have to suggest there is a 64MB module size limit (although I must admit I've not seen a module that big before)?

NedSlider
Forum Moderator
Posts: 2897
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Post by NedSlider » 2012/02/21 19:16:43

To test your maximum size theory, can you see if the module is stripped, and if not strip the module with --strip-debug:

[code]
# file /usr/local/lib/click.ko
[/code]

and if it says "not stripped" then try stripping the module (make a backup of the original version first):

[code]
# cp /usr/local/lib/click.ko /usr/local/lib/click.ko.bak
# strip --strip-debug /usr/local/lib/click.ko
[/code]

Now see how the size of the stripped module compares to the original. Is it less than 64MB, and does it now load?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Increase the maximum size allowed for kernel modules

Post by TrevorH » 2012/02/21 21:49:03

The 3 biggest modules in my kernel are the nvidia, radeon and xfs modules and all of those are less than 20MB in size. I have to ask, does yours actually need to be this large? Can you not split it up into multiple modules? Or is it using huge static arrays of data that might be better relocated elsewhere?

To me, 80MB just sounds ridiculous.

NedSlider
Forum Moderator
Posts: 2897
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Post by NedSlider » 2012/04/24 01:10:28

Just following up on this...

Yes there is a maximum module size of 64MB as defined in module.c:

[code]
/* vmalloc barfs on "unusual" numbers. Check here */
if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL)
[/code]

which was recently removed from more recent upstream kernels:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commitdiff;h=41f8ef7f8b7c2b0b0d1f4682bb70c709c1d3c541

Post Reply