Re: some questions about kernel source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-02-18 at 15:12 +0800, loody wrote:
> Hi all:
> 
> 2011/2/18 John Mahoney <jmahoney@xxxxxxxx>:
> > On Thu, Feb 17, 2011 at 9:17 AM, loody <miloody@xxxxxxxxx> wrote:
> >> hi :-)
> >>
> >> 2011/2/16 Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>:
> >>> Hi :)
> >>>
> >>> On Wed, Feb 16, 2011 at 12:59, Rajat Jain <rajatjain@xxxxxxxxxxx> 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")))
> I try to find "__read_mostly" of mips arch and below are the results I
> grep on arch/
> 
> ......
> ia64/xen/hypervisor.c:29:struct shared_info *HYPERVISOR_shared_info
> __read_mostly =
> mips/kernel/irq_txx9.c:58:static struct txx9_irc_reg __iomem
> *txx9_ircptr __read_mostly;
> mips/kernel/irq_txx9.c:63:} txx9irq[TXx9_MAX_IR] __read_mostly;
> mips/kernel/setup.c:35:struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
> mips/kernel/setup.c:55:unsigned long mips_machtype __read_mostly = MACH_UNKNOWN;
> mips/kernel/setup.c:72:const unsigned long mips_io_port_base __read_mostly = -1;
> mips/kernel/smp.c:58:cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
> mips/kernel/process.c:329:static struct mips_frame_info schedule_mfi
> __read_mostly;
> mips/txx9/generic/irq_tx4939.c:50:} tx4939irq[TX4939_NUM_IR] __read_mostly;
> mips/mm/c-r4k.c:67:static unsigned long icache_size __read_mostly;
> mips/mm/c-r4k.c:68:static unsigned long dcache_size __read_mostly;
> mips/mm/c-r4k.c:69:static unsigned long scache_size __read_mostly;
> parisc/mm/init.c:543:unsigned long *empty_zero_page __read_mostly;
> parisc/include/asm/cache.h:31:#define __read_mostly
> __attribute__((__section__(".data.read_mostly")))
> .....
> x86/vdso/vdso32-setup.c:57:unsigned int __read_mostly vdso_enabled =
> VDSO_DEFAULT;
> x86/include/asm/cache.h:10:#define __read_mostly
> __attribute__((__section__(".data.read_mostly")))
> 
> 
> Does Mips arch not use this option?

arch/mips/include/asm/cache.h:#define __read_mostly
__attribute__((__section__(".data.read_mostly")))





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux