On Tue, 14 Sep 2010 10:09:35 +0800 linuxkernel.xqiang wrote: > Hi all! > I have a question about when and where sock_init() excutes in linux-2.6.35.4. > As I know, when in the old version such as linux-2.6.16, it looks like as fllow: > > start_kernel->rest_init->kernel_thread(init) > init->do_basic_setup->sock_init > > But now in linux-2.6.35.4, sock_init has gone when do_basic_setup excutes. > I notice the some information in linux-2.6.35.4 > > /linux-2.6.35.4/include/init/init.h > #define __define_initcall(level,fn,id) \ > static initcall_t __initcall_##fn##id __used \ > __attribute__((__section__(".initcall" level ".init"))) = fn > #define core_initcall(fn) __define_initcall("1",fn,1) > > /linux-2.6.35.4/net/socket.c > core_initcall(sock_init); /* early initcall */ > > /linux-2.6.35.4/init/main.c > static void __init do_initcalls(void) > { > initcall_t *fn; > for (fn = __early_initcall_end; fn < __initcall_end; fn++) > do_one_initcall(*fn); > /* Make sure there is no pending stuff from the initcall sequence */ > flush_scheduled_work(); > } > > when in linux-2.6.18/arch/i386/kernel/vmlinux.lds.S > .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { > *(.initcall1.init) > *(.initcall2.init) > *(.initcall3.init) > *(.initcall4.init) > *(.initcall5.init) > *(.initcall6.init) > *(.initcall7.init) > } > __initcall_end = .; > now in linux-2.6.35.4/arch/, there is no i386/, so i reached to x86/kernel/vmlinux.lds.S > but in this file, i found no information about section .initcall1.init ~ .initcall7.init > > So i confused when and where sock_init() excutes in linux-2.6.35.4 It executes as a core_initcall, i.e., initcall level 1, just as you found out. do_initcalls() calls all initcalls in order of their level. Within each level they are called in link order, I think. You can see log them being called/exited by booting with the boot option "initcall_debug" on the kernel command line. --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html