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.c79
3 files changed, 117 insertions, 33 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 f1b9f0fdb1b4..2c5ade79eb81 100644
--- a/init/main.c
+++ b/init/main.c
@@ -57,6 +57,7 @@
57#include <linux/debug_locks.h> 57#include <linux/debug_locks.h>
58#include <linux/debugobjects.h> 58#include <linux/debugobjects.h>
59#include <linux/lockdep.h> 59#include <linux/lockdep.h>
60#include <linux/kmemleak.h>
60#include <linux/pid_namespace.h> 61#include <linux/pid_namespace.h>
61#include <linux/device.h> 62#include <linux/device.h>
62#include <linux/kthread.h> 63#include <linux/kthread.h>
@@ -65,6 +66,8 @@
65#include <linux/idr.h> 66#include <linux/idr.h>
66#include <linux/ftrace.h> 67#include <linux/ftrace.h>
67#include <linux/async.h> 68#include <linux/async.h>
69#include <linux/kmemcheck.h>
70#include <linux/kmemtrace.h>
68#include <trace/boot.h> 71#include <trace/boot.h>
69 72
70#include <asm/io.h> 73#include <asm/io.h>
@@ -72,7 +75,6 @@
72#include <asm/setup.h> 75#include <asm/setup.h>
73#include <asm/sections.h> 76#include <asm/sections.h>
74#include <asm/cacheflush.h> 77#include <asm/cacheflush.h>
75#include <trace/kmemtrace.h>
76 78
77#ifdef CONFIG_X86_LOCAL_APIC 79#ifdef CONFIG_X86_LOCAL_APIC
78#include <asm/smp.h> 80#include <asm/smp.h>
@@ -529,6 +531,22 @@ void __init __weak thread_info_cache_init(void)
529{ 531{
530} 532}
531 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
532asmlinkage void __init start_kernel(void) 550asmlinkage void __init start_kernel(void)
533{ 551{
534 char * command_line; 552 char * command_line;
@@ -570,6 +588,23 @@ asmlinkage void __init start_kernel(void)
570 setup_nr_cpu_ids(); 588 setup_nr_cpu_ids();
571 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 589 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
572 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();
573 /* 608 /*
574 * Set up the scheduler prior starting any interrupts (such as the 609 * Set up the scheduler prior starting any interrupts (such as the
575 * timer interrupt). Full topology setup happens at smp_init() 610 * timer interrupt). Full topology setup happens at smp_init()
@@ -581,25 +616,16 @@ asmlinkage void __init start_kernel(void)
581 * fragile until we cpu_idle() for the first time. 616 * fragile until we cpu_idle() for the first time.
582 */ 617 */
583 preempt_disable(); 618 preempt_disable();
584 build_all_zonelists();
585 page_alloc_init();
586 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
587 parse_early_param();
588 parse_args("Booting kernel", static_command_line, __start___param,
589 __stop___param - __start___param,
590 &unknown_bootoption);
591 if (!irqs_disabled()) { 619 if (!irqs_disabled()) {
592 printk(KERN_WARNING "start_kernel(): bug: interrupts were " 620 printk(KERN_WARNING "start_kernel(): bug: interrupts were "
593 "enabled *very* early, fixing it\n"); 621 "enabled *very* early, fixing it\n");
594 local_irq_disable(); 622 local_irq_disable();
595 } 623 }
596 sort_main_extable();
597 trap_init();
598 rcu_init(); 624 rcu_init();
599 /* init some links before init_ISA_irqs() */ 625 /* init some links before init_ISA_irqs() */
600 early_irq_init(); 626 early_irq_init();
601 init_IRQ(); 627 init_IRQ();
602 pidhash_init(); 628 prio_tree_init();
603 init_timers(); 629 init_timers();
604 hrtimers_init(); 630 hrtimers_init();
605 softirq_init(); 631 softirq_init();
@@ -613,6 +639,11 @@ asmlinkage void __init start_kernel(void)
613 early_boot_irqs_on(); 639 early_boot_irqs_on();
614 local_irq_enable(); 640 local_irq_enable();
615 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
616 /* 647 /*
617 * HACK ALERT! This is early. We're enabling the console before 648 * HACK ALERT! This is early. We're enabling the console before
618 * 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
@@ -641,15 +672,10 @@ asmlinkage void __init start_kernel(void)
641 initrd_start = 0; 672 initrd_start = 0;
642 } 673 }
643#endif 674#endif
644 vmalloc_init();
645 vfs_caches_init_early();
646 cpuset_init_early();
647 page_cgroup_init(); 675 page_cgroup_init();
648 mem_init();
649 enable_debug_pagealloc(); 676 enable_debug_pagealloc();
650 cpu_hotplug_init();
651 kmem_cache_init();
652 kmemtrace_init(); 677 kmemtrace_init();
678 kmemleak_init();
653 debug_objects_mem_init(); 679 debug_objects_mem_init();
654 idr_init_cache(); 680 idr_init_cache();
655 setup_per_cpu_pageset(); 681 setup_per_cpu_pageset();
@@ -658,8 +684,6 @@ asmlinkage void __init start_kernel(void)
658 late_time_init(); 684 late_time_init();
659 calibrate_delay(); 685 calibrate_delay();
660 pidmap_init(); 686 pidmap_init();
661 pgtable_cache_init();
662 prio_tree_init();
663 anon_vma_init(); 687 anon_vma_init();
664#ifdef CONFIG_X86 688#ifdef CONFIG_X86
665 if (efi_enabled) 689 if (efi_enabled)
@@ -695,6 +719,17 @@ asmlinkage void __init start_kernel(void)
695 rest_init(); 719 rest_init();
696} 720}
697 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
698int initcall_debug; 733int initcall_debug;
699core_param(initcall_debug, initcall_debug, bool, 0644); 734core_param(initcall_debug, initcall_debug, bool, 0644);
700 735
@@ -775,6 +810,7 @@ static void __init do_basic_setup(void)
775 usermodehelper_init(); 810 usermodehelper_init();
776 driver_init(); 811 driver_init();
777 init_irq_proc(); 812 init_irq_proc();
813 do_ctors();
778 do_initcalls(); 814 do_initcalls();
779} 815}
780 816
@@ -842,6 +878,11 @@ static noinline int init_post(void)
842static int __init kernel_init(void * unused) 878static int __init kernel_init(void * unused)
843{ 879{
844 lock_kernel(); 880 lock_kernel();
881
882 /*
883 * init can allocate pages on any node
884 */
885 set_mems_allowed(node_possible_map);
845 /* 886 /*
846 * init can run on any cpu. 887 * init can run on any cpu.
847 */ 888 */