-   Linux - Software (
-   -   Allocating Memory in the kernel (

arunachalam 10-11-2005 03:49 AM

Allocating Memory in the kernel

jtshaw 10-11-2005 09:41 PM

Ummm, what do you you want to know?

BTW... kmalloc is the method for allocating memory in the kernel.

arunachalam 10-12-2005 12:23 AM

But allocating it in the kernel, and giving it to the user space (getting through pointers), I am unable to access the memory. I triesd with GFP_KERNEL & GFP_USER.

Can I use variable length array concept for pointers in the structures and giving it to the user space.

jtshaw 10-12-2005 07:49 AM

I'll have to dive into one of the kernel books for this one... but I imagine it would be easier to allocate the space in user space in pass it into the kernel via an ioctl or read call to a module in order to have the kernel populate it. As far as I know, you can't kmalloc space and pass it to a userspace process in any straight forward fashion.

sundialsvcs 10-12-2005 09:51 AM

I'm puzzled by this requirement. You can allocate shared-memory segments that processes may share among themselves. The kernel can, if it consents to do so, access anything. (So you could carve out the memory, and ask the kernel to do something with it.) But for memory in kernel space to be accessible by user processes is pretty a no-no. The closest thing that comes to that sort of thing is probably the mechanisms used by, for example, the /proc pseudo-filesystem. The mechanisms that are used to talk to things like the module auto-loader daemon (a privileged process in userland) are other examples.

All times are GMT -5. The time now is 04:09 PM.