Hi Y'all,
I am porting a framebuffer driver from kernel 2.4.19 to 2.6.19 in which __get_free_pages() is used to allocate 0x915d40 bytes (apprx 2300 pages) of GFP_ATOMIC memory.
Trying to use the function as is in kernel 2.6 gives me "allocation failed" error. I tried to use kmalloc but I guess kmalloc cannot allocate such a huge chunk.
Can anyone tell me why __get_free_pages() is failing? Is there any other way I can get the huge chunk other than __get_free_pages?
Thanks,
KT
why?
why GFP_ATOMIC? why do you say "allocate GFP_ATOMIC memory" instead of "GFP_ATOMIC allocate memory"?
I only meant to say that
I only meant to say that flag being passed to __get_free_pages is GFP_ATOMIC
still 'why?'
i understood this but i have to ask again why are you doing that? what do you try to accomplish?
GFP flags
It's pretty clear that what Anonymous is trying to accomplish is to port a driver that somebody else wrote.
In the initialization code, change GFP_ATOMIC to GFP_KERNEL and give it a try.
Hello Ferdinand, You were
Hello Ferdinand,
You were right I was porting somebody else's framebuffer driver and I solved the reason why __get_free_pages is failing.
The problem is the number of pages the driver is requesting via __get_free_pages() which is 1 more than MAX_ORDER used by alloc_pages().
And MAX_ORDER is defined in include/linux/mmzone.h as
#ifndef CONFIG_FORCE_MAX_ZONEORDER
#define MAX_ORDER 11
#else
#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
#endif
Defining CONFIG_FORCE_MAX_ZONEORDER to the number of pages the driver needs helped solve the problem. It does not matter whether you use GFP_ATOMIC or GFP_KERNEL.
Thanks,
KT
Question still remains.. why you can't do without GFP_ATOMIC
Hi,
I really appreciate the way you came up with the solution.. but you want you are using GFP_ATOMIC.... i guess you can do without it.. or you have some other purpose
Manish