Skip to contentSkip to conversation

allocation of contiguous memory in kernel mode

DISCUSSION J.Hwan Kim 2 participants 2 messages Aug 9, 2012 – Aug 13, 2012

lore
Share & tools
lore

J.Hwan Kim

author
#0 lore raw

Hi, everyone

I wish to alloc physically contiguous memory in kernel mode. I used the __get_free_pages(gfp_mask, order) function, but it fails occasionary.
I guess it is caused by memory fragmentation.
My code is kernel driver module which cannot use bootmem allocation and its platform is x86_64.
My server desktop has 20GB memory.
I wish to know the method to allocate physically contiguous memory not failing by fragmentation.

Thanks in advance.

Best Regards,
J.Hwan Kim

#1 lore raw
Quoted 11 lines · J.Hwan Kim

Hi, everyone

I wish to alloc physically contiguous memory in kernel mode. I used the __get_free_pages(gfp_mask, order) function, but it fails occasionary.
I guess it is caused by memory fragmentation.
My code is kernel driver module which cannot use bootmem allocation and its platform is x86_64.
My server desktop has 20GB memory.
I wish to know the method to allocate physically contiguous memory not failing by fragmentation.

There is no easy answer.

The most portable option is to change the requirements so that you don't need physically contiguous memory. This is what most network devices did to handle jumbo frames.

Can you build a new kernel with your code added instead of using a module?

What about booting with artificially limited physical memory (on the kernel commandline) and then have the module explictly map in memory from above the usual memory limit?

Chris