Messages in this thread | | | Date | Mon, 2 Dec 2002 08:13:47 -0500 (EST) | From | "Richard B. Johnson" <> | Subject | Re: Size limitation for the module |
| |
On Fri, 29 Nov 2002, Super user wrote:
> Hi All, > > I have a kernel module which is a huge one. Around 1.5 > MB. Is there any known problems in having a such a big > module. > > The problem is after inserting the module, the box > freezes after some time.
[SNIPPED...]
There might not be 1.5 MB available from kmalloc() and there may be a bug in kmalloc() when it gets to allocating more memory than it has (these boundary conditions may not have been tested very well, or your module isn't checking returned results).
Normally, if you need lots of memory for a module, you tell the kernel upon boot that there is less memory than there is. IOW, you reserve it. Then, in your module you use ioremap() to allocate it exclusively for your module.
This method has many advantages as well. FYI, the memory is never paged, it's always immediately available for your module.
In principle, you are supposed to use copy/from/to/io and read/b/w/l/write/b/w/l to access it, but on ix86 (only), you can initialize a pointer with the value returned from ioremap().
This, of course is not portable, but a module allocation of 1.5 MB is not portable anyway, so doit2it.
Cheers, Dick Johnson Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Bush : The Fourth Reich of America
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |