Increase the maximum size allowed for kernel modules

General support questions

Increase the maximum size allowed for kernel modules

Postby 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
jamm007
 
Posts: 1
Joined: 2012/02/21 14:59:43

Increase the maximum size allowed for kernel modules

Postby NedSlider » 2012/02/21 18:54:27

What does dmesg say?
NedSlider
 
Posts: 2848
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Postby 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
 
Posts: 2848
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Postby 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: Select all
# file /usr/local/lib/click.ko


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

Code: Select all
# cp /usr/local/lib/click.ko /usr/local/lib/click.ko.bak
# strip --strip-debug /usr/local/lib/click.ko


Now see how the size of the stripped module compares to the original. Is it less than 64MB, and does it now load?
NedSlider
 
Posts: 2848
Joined: 2005/10/28 13:11:50
Location: UK

Re: Increase the maximum size allowed for kernel modules

Postby 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.
User avatar
TrevorH
Forum Moderator
 
Posts: 9077
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Increase the maximum size allowed for kernel modules

Postby 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: Select all
       /* vmalloc barfs on "unusual" numbers.  Check here */
       if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL)


which was recently removed from more recent upstream kernels:

http://git.kernel.org/?p=linux/kernel/g ... 09c1d3c541
NedSlider
 
Posts: 2848
Joined: 2005/10/28 13:11:50
Location: UK


Return to CentOS 6 - General Support

Who is online

Users browsing this forum: No registered users and 12 guests