views:

52

answers:

1

Are there any restrictions on memory usage by a Linux Kernel Module i.e Code Segment size or amount of global memory or any thing.

+4  A: 
  • In 2.6.35, load_module() bails out if the length of the module to load exceeds 64 MB: http://lxr.linux.no/#linux+v2.6.35/kernel/module.c#L2118
  • vmalloc() is used to allocate space for the module -- this fails if you try to allocate more pages than available in your physical memory (which in turn will probably only be an issue for embedded stuff with low RAM)
  • Furthermore, kzalloc() (and in turn, kmalloc()) are used. Depending on the allocator used (SLAB, SLOB, SLUB), there may be restrictions as well. SLAB defines a KMALLOC_MAX_SIZE wich defines the maximum number of bytes you can allocate with a single call to kmalloc().
BjoernD