| Linux - Kernel This forum is for all discussion relating to the Linux kernel. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-18-2012, 12:40 PM
|
#1
|
|
LQ Newbie
Registered: Jun 2011
Location: Mission Viejo, CA
Distribution: Fedora 9, 13 and 15.
Posts: 11
Rep: 
|
What is trace_mm_page_alloc()?
This is a very specific question for which I was baffled for an answer. I have searched the forums, but maybe I was too specific.
I'm getting an OOM error, specifically for DMA memory allocated with dma_generic_alloc_coherent(). I'm trying to figure out where the kernel is calling printk() within the function __alloc_pages_nodemask() (which is called from dma_generic_alloc_coherent). I came upon the function trace_mm_page_alloc(), and I'm guessing this is a macro with some kind of logic that ultimately performs a printk().
I went to the top of the kernel source tree (Ubuntu 1.2.2) and did the following:
find . -type f -exec grep trace_mm_page_alloc \{} \; -print
It is my theory that this should have searched EVERY file, no matter whether it is documentation or C code or assembly or header file. The only place it was found was in __alloc_pages_nodemask(). The response being:
trace_mm_page_alloc_extfrag(page, order, current_order,
trace_mm_page_alloc_zone_locked(page, order, migratetype);
trace_mm_page_alloc(page, order, gfp_mask, migratetype);
./mm/page_alloc.c
In other words, it is not DEFINED anywhere. It is not DOCUMENTED anywhere. How is it compiled?
Does anybody have any ideas on where it's defined and what this function does?
Thanks.
Chris
|
|
|
|
05-18-2012, 12:53 PM
|
#2
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,760
|
how did you find this function (trace_mm_page_alloc)? You can try to use nm <some *.so> instead of this grep to find where is it implemented (but maybe you won't find it)
|
|
|
|
05-18-2012, 04:51 PM
|
#3
|
|
LQ Newbie
Registered: Jun 2011
Location: Mission Viejo, CA
Distribution: Fedora 9, 13 and 15.
Posts: 11
Original Poster
Rep: 
|
trace_mm_page_alloc()
Thanks for the reply.
I was walking through the backtrace generated in the printk ring buffer (via dmesg). It indicated one of the functions was the dma_general_alloc_coherent(), and I stepped through it. The actual error occurred in a printk(), which is what I wanted to see.
Part of my issue is, why can't I find a definition for it? Is there some macro pre-process that is happening that changes the names of functions before they're compiled?
Your idea of using nm to see which .o defines it is a good one. I'll give that a try.
Thanks again,
Chris
|
|
|
|
05-19-2012, 03:24 AM
|
#4
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,760
|
in the linux kernel source tree I found the following:
include/trace/events/kmem.h:TRACE_EVENT(mm_page_alloc,
here is some documentation: Documentation/trace/events-kmem.txt
and it is probably called from mm/page_alloc.c
The implementation is based on include/linux/tracepoint.h where you can see it will be evaluated as a static inline void trace_<something>
(so it is implemented inline in the kernel, you will not find any other .o or .so containing it).
Also marcos are resolved compile time, you will not be able to find macros during a debug session.
|
|
|
1 members found this post helpful.
|
05-19-2012, 01:01 PM
|
#5
|
|
LQ Newbie
Registered: Jun 2011
Location: Mission Viejo, CA
Distribution: Fedora 9, 13 and 15.
Posts: 11
Original Poster
Rep: 
|
Wow! Thanks for that! No wonder I couldn't find it anywhere.
I didn't need to find it in a debug session, I just wanted to know what the function did, what caused it to print, etc. That's exactly the info I needed to keep me going.
Thanks again,
Chris
|
|
|
|
05-19-2012, 01:06 PM
|
#6
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,760
|
Great!
__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:30 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|