In OMAPL138 linux build, dynamic memory can be allocated by kmalloc(). kmalloc() can allocate maximum 128k byte. How can i increase/decrese this allocation?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
In OMAPL138 linux build, dynamic memory can be allocated by kmalloc(). kmalloc() can allocate maximum 128k byte. How can i increase/decrese this allocation?
Hi,
The kmalloc max size is defined by following,
#define KMALLOC_MAX_SIZE (1UL << 30) (Look into source/include/linux/slab.h).
The 128Kb was in earlier kernel version. Now as of now in 3.10 kernel its (1 << 30)
--
Regards,
Prabhakar Lad
hi Prabhakar Lad,
I saw that kmalloc size is 2^25=32MB, can i change 25 to 28 to get 256MB? like in below line if 25 is replaced with 28.
#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
(MAX_ORDER + PAGE_SHIFT - 1) : 25)
#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH)
Hi Clemens Ladisch,
I read that kmalloc is fast as it allocates physical memory directly. if i will use vmalloc, then it will be slow and memory will also not continous. is vmalloc is like memory mapping as we do in user space. i am learning linux, Please highlight points, if i am on wrong track.
What you have read is mostly correct.
However, you have not answered either of my questions.
Hi,
Yes you can definitely change it to 28, but kmalloc will fail if there isnt
such huge continuous memory.
What is your use case so that you want such huge memory ?
Regards,
--Prabhakar Lad
http://www.linkedin.com/in/prabhakarlad