On Thu, Feb 17, 2011 at 9:17 AM, loody <miloody@gmail.com> wrote:
hi :-)
2011/2/16 Mulyadi Santosa <mulyadi.santosa@gmail.com>:
Hi :)
On Wed, Feb 16, 2011 at 12:59, Rajat Jain <rajatjain@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?
It is a macro defined for x86 as: #define __read_mostly __attribute__((__section__(".data..read_mostly"))) http://lxr.linux.no/linux+v2.6.37/arch/x86/include/asm/cache.h ---snip--- Start a new thread for a new topic. -- John