Discussion:
Allocating a large chunk of memory in the kernel (2mb)
(too old to reply)
David Frascone
2005-01-03 01:33:08 UTC
Permalink
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.

Basically, the area is for DMA / shared memory for a pci card.

So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.

So, how do I malloc 2Mb of contiguous space?

-Dave
--
David Frascone

Oxymoron: Safe Sex.
root
2005-01-03 05:31:13 UTC
Permalink
?? man malloc ??
Post by David Frascone
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.
Basically, the area is for DMA / shared memory for a pci card.
So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.
So, how do I malloc 2Mb of contiguous space?
-Dave
David Frascone
2005-01-03 14:30:02 UTC
Permalink
I can only assume that this is a troll. Otherwise it would take a pretty big idiot to ignore the word "kernel" in the subject, and ignoring the sentence in the body where I said that kmalloc will not return me 2mb of memory.

Unless I'm the moron, and malloc was added to kernel space . . . let me know.

-Dave

On Sun, 02 Jan 2005 23:31:13 -0600
Post by root
?? man malloc ??
Post by David Frascone
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.
Basically, the area is for DMA / shared memory for a pci card.
So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.
So, how do I malloc 2Mb of contiguous space?
-Dave
--
David Frascone

Psychiatrists stay on your mind.
Mihai Osian
2005-01-03 14:58:17 UTC
Permalink
Post by David Frascone
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.
Basically, the area is for DMA / shared memory for a pci card.
So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.
So, how do I malloc 2Mb of contiguous space?
-Dave
Hi Dave,

Perhaps __get_dma_pages ? Never used this function myself, but it's
described in http://www.xml.com/ldd/chapter/book/ch07.html
Anyway, linux.kernel might be a better newsgroup for you to ask.

Mihai
David Frascone
2005-01-03 15:02:08 UTC
Permalink
On Mon, 03 Jan 2005 15:58:17 +0100
Post by Mihai Osian
Post by David Frascone
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.
Basically, the area is for DMA / shared memory for a pci card.
So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.
So, how do I malloc 2Mb of contiguous space?
-Dave
Hi Dave,
Perhaps __get_dma_pages ? Never used this function myself, but it's
described in http://www.xml.com/ldd/chapter/book/ch07.html
Anyway, linux.kernel might be a better newsgroup for you to ask.
Thanks, that is exactly the direction I'm looking.

I still don't think that's going to be enough, though. Looks like it maxes out at 2mb, and I might need two 2mb chunks. I'll give it a try though. I'm leaning toward the bigphysmem patch now. It might give me what I need.

I'll post when I find a solution.

-Dave
--
David Frascone

Don't ask me, I'm making this up as I go!
David Frascone
2005-01-03 15:37:04 UTC
Permalink
On Mon, 03 Jan 2005 15:02:08 GMT
Post by David Frascone
On Mon, 03 Jan 2005 15:58:17 +0100
Post by Mihai Osian
Post by David Frascone
I need to allocate 2mb for a brain dead driver. The existing driver likes to get it's memory by using mem=<realmem = 2mb>, then ioremaping the top of physical memory to get raw access to it.
Basically, the area is for DMA / shared memory for a pci card.
So, I'm trying to remove the mem= dependency, and just allocate a large buffer to use with the driver. But, kmalloc doesn't like to give out chunks that size.
So, how do I malloc 2Mb of contiguous space?
-Dave
Hi Dave,
Perhaps __get_dma_pages ? Never used this function myself, but it's
described in http://www.xml.com/ldd/chapter/book/ch07.html
Anyway, linux.kernel might be a better newsgroup for you to ask.
Thanks, that is exactly the direction I'm looking.
I still don't think that's going to be enough, though. Looks like it maxes out at 2mb, and I might need two 2mb chunks. I'll give it a try though. I'm leaning toward the bigphysmem patch now. It might give me what I need.
I'll post when I find a solution.
Get DMA pages worked! It let me use an order of 9, for 512 4k pages (2mb). And, I was able to allocate both that I needed.

Thanks so much for your help!

-Dave
--
David Frascone

Computers are not intelligent. They only think they are.
Loading...