Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 11-23-2010, 08:19 AM   #1
Registered: Sep 2007
Posts: 169

Rep: Reputation: 23
Allocating 16MB of kernel space _get_free_pages


I tried to call _get_free_pages (GFP_KERNEL,12) in order to allocate 16MB of continuous kernel memory.

I do it only once when the user tries to open the device.

The call returns 0. So the allocation fails.

How can I allocate 16MB in the kernel ?

According to chapter 8 in the Device Driver book (page 222): "The maximum allowed value for order is 10 or 11(corresponding to 1024 or 2048 pages), depending on the architecture.

Old 11-23-2010, 02:34 PM   #2
Senior Member
Registered: Apr 2009
Posts: 1,496

Rep: Reputation: 136Reputation: 136
You can reserve the kind of big memory at boot time.
Old 11-23-2010, 03:40 PM   #3
Registered: Sep 2007
Posts: 169

Original Poster
Rep: Reputation: 23
Is this the only way ?

Originally Posted by nini09 View Post
You can reserve the kind of big memory at boot time.
Thank you for your reply.

According to DD3,chapter-8:

Allocating memory at boot time is a “dirty” technique, because it bypasses all memory management policies by reserving a private memory pool. This technique is inelegant and inflexible, but it is also the least prone to failure. Needless to say, a module can’t allocate memory at boot time; only drivers directly linked to the kernel can do that.

Is this the way a video adapter driver allocates memory ?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to allocate a block of 16MB in kernel space using my driver module s_anumolu Linux - General 1 07-15-2005 12:48 AM
Allocating hard drive space Armon Linux - General 4 05-05-2005 08:26 PM
Need Help Allocating Space on my HD to install linux! chrishikel Linux - Newbie 6 09-10-2004 02:55 PM
allocating space for new partition ranger12002 Linux - General 12 07-20-2003 03:07 PM
allocating space and a couple other things Cheese Linux - Software 2 12-09-2001 03:55 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration