INFO REQ: Clarification of Memory Management
I'm a little confused about the way the Linux kernel allocates memory, and I'm hoping someone could clarify this for me.
Does the __get_free_pages() function eventually call the kmalloc() function? Or does the kmalloc() function eventually call the __get_free_pages() function? Or are these two totally separate functions for different purposes?
Which of these functions can be called by user process for the purpose of allocating memory for that user process?
TIA
Joseph Wagner
Flames will be directed to /dev/null
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 4 lines
Does the
__get_free_pages()function eventually call thekmalloc()function? Or does thekmalloc()function eventually call the__get_free_pages()function? Or are these two totally separate functions for different purposes?
kmalloc() will eventually call get_free_pages(), but you really shouldn't ever need to know that, unless you're fiddling with the implementations of either function.
Note that, even though kmalloc() uses get_free_pages() to allocate memory, it performs various other bookkeeping tasks, and so the two types of memory allocations really can't be mixed.
Quoted 2 lines
Which of these functions can be called by user process for the purpose of allocating memory for that user process?
Neither; use malloc() in userspace. (Or the new operator if you're using C++)
Steven Smith,
[email protected].
Quoted 11 lines · Joseph D. Wagner
I'm a little confused about the way the Linux kernel allocates memory, and I'm hoping someone could clarify this for me.
Does the
__get_free_pages()function eventually call thekmalloc()function? Or does thekmalloc()function eventually call the__get_free_pages()function? Or are these two totally separate functions for different purposes?Which of these functions can be called by user process for the purpose of allocating memory for that user process?
Unless *I'm* totally lost here (which is very possible) you are asking
about functions which are internal to the kernel and not for direct use from userspace.
Ken
Quoted 6 lines
TIA
Joseph Wagner
Flames will be directed to
/dev/null
Signature · 10 lines
Out of the darkness a voice spake unto me, saying "smile, things could be worse". So I smiled, and lo, things became worse. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs