some questions about kernel source

loody miloody at gmail.com
Thu Feb 17 09:17:30 EST 2011


hi :-)

2011/2/16 Mulyadi Santosa <mulyadi.santosa at gmail.com>:
> Hi :)
>
> On Wed, Feb 16, 2011 at 12:59, Rajat Jain <rajatjain at juniper.net> wrote:
>> Hello loody,
>>
>>> 1. in kernel/trace, I always see "__read_mostly" at the end of
>>> parameter is that a compiler optimization parameter?
>>
>> Yes, it is a hint to the compiler that the parameter is mostly read, thus if the compiler has to make a decision between optimizing one of the read / write paths, it will optimize the read path even at the expense of write path.
>
>
> To be precise, they will be grouped into same cache line as much as
> possible. By doing so, those cache line won't be invalidated so often
> (keeping them "hot" :) hehehhe )

I cannot find it on the gcc manual.
is it a option in kernel for kernel usage?
if so, where I can found them.
If not, can I use it on normal user level program?

BTW, i have some more questions (since it is also related to kernel, I
append in the same mail)
1. the parameters we pass to ftrace_trace_function are (unsigned long
ip, unsigned long parent_ip), which are previous and pre-previous
return address.
what can we do on these 2 addresses?

2. per kernel document, HAVE_FUNCTION_TRACE_MCOUNT_TEST is used for "
an optional optimization for the normal case" and there is a pseudo
sample code such as
+       if (function_trace_stop)
+               return;
so the optimization the config did is judge whether
"function_trace_stop" before operation, right?
Meanwhile, I found this judgement seems enable in
ftrace_test_stop_func and it is located at #ifndef
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST.
The source code seems quite conflict with the document.


-- 
Appreciate your kind help,
miloody



More information about the Kernelnewbies mailing list