aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig68
-rw-r--r--init/do_mounts.c3
-rw-r--r--init/main.c85
3 files changed, 118 insertions, 38 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 7be4d3836745..1ce05a4cb5f6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -16,6 +16,11 @@ config DEFCONFIG_LIST
16 default "$ARCH_DEFCONFIG" 16 default "$ARCH_DEFCONFIG"
17 default "arch/$ARCH/defconfig" 17 default "arch/$ARCH/defconfig"
18 18
19config CONSTRUCTORS
20 bool
21 depends on !UML
22 default y
23
19menu "General setup" 24menu "General setup"
20 25
21config EXPERIMENTAL 26config EXPERIMENTAL
@@ -302,13 +307,14 @@ config AUDITSYSCALL
302 307
303config AUDIT_TREE 308config AUDIT_TREE
304 def_bool y 309 def_bool y
305 depends on AUDITSYSCALL && INOTIFY 310 depends on AUDITSYSCALL
311 select INOTIFY
306 312
307menu "RCU Subsystem" 313menu "RCU Subsystem"
308 314
309choice 315choice
310 prompt "RCU Implementation" 316 prompt "RCU Implementation"
311 default CLASSIC_RCU 317 default TREE_RCU
312 318
313config CLASSIC_RCU 319config CLASSIC_RCU
314 bool "Classic RCU" 320 bool "Classic RCU"
@@ -615,13 +621,13 @@ config SYSFS_DEPRECATED
615 bool 621 bool
616 622
617config SYSFS_DEPRECATED_V2 623config SYSFS_DEPRECATED_V2
618 bool "Create deprecated sysfs layout for older userspace tools" 624 bool "remove sysfs features which may confuse old userspace tools"
619 depends on SYSFS 625 depends on SYSFS
620 default y 626 default n
621 select SYSFS_DEPRECATED 627 select SYSFS_DEPRECATED
622 help 628 help
623 This option switches the layout of sysfs to the deprecated 629 This option switches the layout of sysfs to the deprecated
624 version. 630 version. Do not use it on recent distributions.
625 631
626 The current sysfs layout features a unified device tree at 632 The current sysfs layout features a unified device tree at
627 /sys/devices/, which is able to express a hierarchy between 633 /sys/devices/, which is able to express a hierarchy between
@@ -808,14 +814,6 @@ config KALLSYMS_EXTRA_PASS
808 you wait for kallsyms to be fixed. 814 you wait for kallsyms to be fixed.
809 815
810 816
811config STRIP_ASM_SYMS
812 bool "Strip assembler-generated symbols during link"
813 default n
814 help
815 Strip internal assembler-generated symbols during a link (symbols
816 that look like '.Lxxx') so they don't pollute the output of
817 get_wchan() and suchlike.
818
819config HOTPLUG 817config HOTPLUG
820 bool "Support for hot-pluggable devices" if EMBEDDED 818 bool "Support for hot-pluggable devices" if EMBEDDED
821 default y 819 default y
@@ -933,6 +931,42 @@ config AIO
933 by some high performance threaded applications. Disabling 931 by some high performance threaded applications. Disabling
934 this option saves about 7k. 932 this option saves about 7k.
935 933
934config HAVE_PERF_COUNTERS
935 bool
936 help
937 See tools/perf/design.txt for details.
938
939menu "Performance Counters"
940
941config PERF_COUNTERS
942 bool "Kernel Performance Counters"
943 depends on HAVE_PERF_COUNTERS
944 select ANON_INODES
945 help
946 Enable kernel support for performance counter hardware.
947
948 Performance counters are special hardware registers available
949 on most modern CPUs. These registers count the number of certain
950 types of hw events: such as instructions executed, cachemisses
951 suffered, or branches mis-predicted - without slowing down the
952 kernel or applications. These registers can also trigger interrupts
953 when a threshold number of events have passed - and can thus be
954 used to profile the code that runs on that CPU.
955
956 The Linux Performance Counter subsystem provides an abstraction of
957 these hardware capabilities, available via a system call. It
958 provides per task and per CPU counters, and it provides event
959 capabilities on top of those.
960
961 Say Y if unsure.
962
963config EVENT_PROFILE
964 bool "Tracepoint profile sources"
965 depends on PERF_COUNTERS && EVENT_TRACER
966 default y
967
968endmenu
969
936config VM_EVENT_COUNTERS 970config VM_EVENT_COUNTERS
937 default y 971 default y
938 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED 972 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
@@ -961,6 +995,14 @@ config SLUB_DEBUG
961 SLUB sysfs support. /sys/slab will not exist and there will be 995 SLUB sysfs support. /sys/slab will not exist and there will be
962 no support for cache validation etc. 996 no support for cache validation etc.
963 997
998config STRIP_ASM_SYMS
999 bool "Strip assembler-generated symbols during link"
1000 default n
1001 help
1002 Strip internal assembler-generated symbols during a link (symbols
1003 that look like '.Lxxx') so they don't pollute the output of
1004 get_wchan() and suchlike.
1005
964config COMPAT_BRK 1006config COMPAT_BRK
965 bool "Disable heap randomization" 1007 bool "Disable heap randomization"
966 default y 1008 default y
diff --git a/init/do_mounts.c b/init/do_mounts.c
index dd7ee5f203f3..093f65915501 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -231,7 +231,8 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
231 231
232void __init mount_block_root(char *name, int flags) 232void __init mount_block_root(char *name, int flags)
233{ 233{
234 char *fs_names = __getname(); 234 char *fs_names = __getname_gfp(GFP_KERNEL
235 | __GFP_NOTRACK_FALSE_POSITIVE);
235 char *p; 236 char *p;
236#ifdef CONFIG_BLOCK 237#ifdef CONFIG_BLOCK
237 char b[BDEVNAME_SIZE]; 238 char b[BDEVNAME_SIZE];
diff --git a/init/main.c b/init/main.c
index d721dad05dd7..2c5ade79eb81 100644
--- a/init/main.c
+++ b/init/main.c
@@ -24,6 +24,7 @@
24#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
25#include <linux/initrd.h> 25#include <linux/initrd.h>
26#include <linux/bootmem.h> 26#include <linux/bootmem.h>
27#include <linux/acpi.h>
27#include <linux/tty.h> 28#include <linux/tty.h>
28#include <linux/gfp.h> 29#include <linux/gfp.h>
29#include <linux/percpu.h> 30#include <linux/percpu.h>
@@ -56,6 +57,7 @@
56#include <linux/debug_locks.h> 57#include <linux/debug_locks.h>
57#include <linux/debugobjects.h> 58#include <linux/debugobjects.h>
58#include <linux/lockdep.h> 59#include <linux/lockdep.h>
60#include <linux/kmemleak.h>
59#include <linux/pid_namespace.h> 61#include <linux/pid_namespace.h>
60#include <linux/device.h> 62#include <linux/device.h>
61#include <linux/kthread.h> 63#include <linux/kthread.h>
@@ -64,6 +66,8 @@
64#include <linux/idr.h> 66#include <linux/idr.h>
65#include <linux/ftrace.h> 67#include <linux/ftrace.h>
66#include <linux/async.h> 68#include <linux/async.h>
69#include <linux/kmemcheck.h>
70#include <linux/kmemtrace.h>
67#include <trace/boot.h> 71#include <trace/boot.h>
68 72
69#include <asm/io.h> 73#include <asm/io.h>
@@ -71,7 +75,6 @@
71#include <asm/setup.h> 75#include <asm/setup.h>
72#include <asm/sections.h> 76#include <asm/sections.h>
73#include <asm/cacheflush.h> 77#include <asm/cacheflush.h>
74#include <trace/kmemtrace.h>
75 78
76#ifdef CONFIG_X86_LOCAL_APIC 79#ifdef CONFIG_X86_LOCAL_APIC
77#include <asm/smp.h> 80#include <asm/smp.h>
@@ -86,11 +89,6 @@ extern void sbus_init(void);
86extern void prio_tree_init(void); 89extern void prio_tree_init(void);
87extern void radix_tree_init(void); 90extern void radix_tree_init(void);
88extern void free_initmem(void); 91extern void free_initmem(void);
89#ifdef CONFIG_ACPI
90extern void acpi_early_init(void);
91#else
92static inline void acpi_early_init(void) { }
93#endif
94#ifndef CONFIG_DEBUG_RODATA 92#ifndef CONFIG_DEBUG_RODATA
95static inline void mark_rodata_ro(void) { } 93static inline void mark_rodata_ro(void) { }
96#endif 94#endif
@@ -533,6 +531,22 @@ void __init __weak thread_info_cache_init(void)
533{ 531{
534} 532}
535 533
534/*
535 * Set up kernel memory allocators
536 */
537static void __init mm_init(void)
538{
539 /*
540 * page_cgroup requires countinous pages as memmap
541 * and it's bigger than MAX_ORDER unless SPARSEMEM.
542 */
543 page_cgroup_init_flatmem();
544 mem_init();
545 kmem_cache_init();
546 pgtable_cache_init();
547 vmalloc_init();
548}
549
536asmlinkage void __init start_kernel(void) 550asmlinkage void __init start_kernel(void)
537{ 551{
538 char * command_line; 552 char * command_line;
@@ -574,6 +588,23 @@ asmlinkage void __init start_kernel(void)
574 setup_nr_cpu_ids(); 588 setup_nr_cpu_ids();
575 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 589 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
576 590
591 build_all_zonelists();
592 page_alloc_init();
593
594 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
595 parse_early_param();
596 parse_args("Booting kernel", static_command_line, __start___param,
597 __stop___param - __start___param,
598 &unknown_bootoption);
599 /*
600 * These use large bootmem allocations and must precede
601 * kmem_cache_init()
602 */
603 pidhash_init();
604 vfs_caches_init_early();
605 sort_main_extable();
606 trap_init();
607 mm_init();
577 /* 608 /*
578 * Set up the scheduler prior starting any interrupts (such as the 609 * Set up the scheduler prior starting any interrupts (such as the
579 * timer interrupt). Full topology setup happens at smp_init() 610 * timer interrupt). Full topology setup happens at smp_init()
@@ -585,25 +616,16 @@ asmlinkage void __init start_kernel(void)
585 * fragile until we cpu_idle() for the first time. 616 * fragile until we cpu_idle() for the first time.
586 */ 617 */
587 preempt_disable(); 618 preempt_disable();
588 build_all_zonelists();
589 page_alloc_init();
590 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
591 parse_early_param();
592 parse_args("Booting kernel", static_command_line, __start___param,
593 __stop___param - __start___param,
594 &unknown_bootoption);
595 if (!irqs_disabled()) { 619 if (!irqs_disabled()) {
596 printk(KERN_WARNING "start_kernel(): bug: interrupts were " 620 printk(KERN_WARNING "start_kernel(): bug: interrupts were "
597 "enabled *very* early, fixing it\n"); 621 "enabled *very* early, fixing it\n");
598 local_irq_disable(); 622 local_irq_disable();
599 } 623 }
600 sort_main_extable();
601 trap_init();
602 rcu_init(); 624 rcu_init();
603 /* init some links before init_ISA_irqs() */ 625 /* init some links before init_ISA_irqs() */
604 early_irq_init(); 626 early_irq_init();
605 init_IRQ(); 627 init_IRQ();
606 pidhash_init(); 628 prio_tree_init();
607 init_timers(); 629 init_timers();
608 hrtimers_init(); 630 hrtimers_init();
609 softirq_init(); 631 softirq_init();
@@ -617,6 +639,11 @@ asmlinkage void __init start_kernel(void)
617 early_boot_irqs_on(); 639 early_boot_irqs_on();
618 local_irq_enable(); 640 local_irq_enable();
619 641
642 /* Interrupts are enabled now so all GFP allocations are safe. */
643 set_gfp_allowed_mask(__GFP_BITS_MASK);
644
645 kmem_cache_init_late();
646
620 /* 647 /*
621 * HACK ALERT! This is early. We're enabling the console before 648 * HACK ALERT! This is early. We're enabling the console before
622 * we've done PCI setups etc, and console_init() must be aware of 649 * we've done PCI setups etc, and console_init() must be aware of
@@ -645,15 +672,10 @@ asmlinkage void __init start_kernel(void)
645 initrd_start = 0; 672 initrd_start = 0;
646 } 673 }
647#endif 674#endif
648 vmalloc_init();
649 vfs_caches_init_early();
650 cpuset_init_early();
651 page_cgroup_init(); 675 page_cgroup_init();
652 mem_init();
653 enable_debug_pagealloc(); 676 enable_debug_pagealloc();
654 cpu_hotplug_init();
655 kmem_cache_init();
656 kmemtrace_init(); 677 kmemtrace_init();
678 kmemleak_init();
657 debug_objects_mem_init(); 679 debug_objects_mem_init();
658 idr_init_cache(); 680 idr_init_cache();
659 setup_per_cpu_pageset(); 681 setup_per_cpu_pageset();
@@ -662,8 +684,6 @@ asmlinkage void __init start_kernel(void)
662 late_time_init(); 684 late_time_init();
663 calibrate_delay(); 685 calibrate_delay();
664 pidmap_init(); 686 pidmap_init();
665 pgtable_cache_init();
666 prio_tree_init();
667 anon_vma_init(); 687 anon_vma_init();
668#ifdef CONFIG_X86 688#ifdef CONFIG_X86
669 if (efi_enabled) 689 if (efi_enabled)
@@ -699,6 +719,17 @@ asmlinkage void __init start_kernel(void)
699 rest_init(); 719 rest_init();
700} 720}
701 721
722/* Call all constructor functions linked into the kernel. */
723static void __init do_ctors(void)
724{
725#ifdef CONFIG_CONSTRUCTORS
726 ctor_fn_t *call = (ctor_fn_t *) __ctors_start;
727
728 for (; call < (ctor_fn_t *) __ctors_end; call++)
729 (*call)();
730#endif
731}
732
702int initcall_debug; 733int initcall_debug;
703core_param(initcall_debug, initcall_debug, bool, 0644); 734core_param(initcall_debug, initcall_debug, bool, 0644);
704 735
@@ -779,6 +810,7 @@ static void __init do_basic_setup(void)
779 usermodehelper_init(); 810 usermodehelper_init();
780 driver_init(); 811 driver_init();
781 init_irq_proc(); 812 init_irq_proc();
813 do_ctors();
782 do_initcalls(); 814 do_initcalls();
783} 815}
784 816
@@ -846,6 +878,11 @@ static noinline int init_post(void)
846static int __init kernel_init(void * unused) 878static int __init kernel_init(void * unused)
847{ 879{
848 lock_kernel(); 880 lock_kernel();
881
882 /*
883 * init can allocate pages on any node
884 */
885 set_mems_allowed(node_possible_map);
849 /* 886 /*
850 * init can run on any cpu. 887 * init can run on any cpu.
851 */ 888 */