aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig80
-rw-r--r--init/Makefile4
-rw-r--r--init/calibrate.c3
-rw-r--r--init/do_mounts.c6
-rw-r--r--init/do_mounts_initrd.c1
-rw-r--r--init/do_mounts_rd.c13
-rw-r--r--init/init_task.c24
-rw-r--r--init/main.c104
8 files changed, 171 insertions, 64 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 3f42cd66f0f..a30fe085940 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -27,6 +27,9 @@ config IRQ_WORK
27 bool 27 bool
28 depends on HAVE_IRQ_WORK 28 depends on HAVE_IRQ_WORK
29 29
30config BUILDTIME_EXTABLE_SORT
31 bool
32
30menu "General setup" 33menu "General setup"
31 34
32config EXPERIMENTAL 35config EXPERIMENTAL
@@ -438,15 +441,6 @@ config PREEMPT_RCU
438 This option enables preemptible-RCU code that is common between 441 This option enables preemptible-RCU code that is common between
439 the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations. 442 the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
440 443
441config RCU_TRACE
442 bool "Enable tracing for RCU"
443 help
444 This option provides tracing in RCU which presents stats
445 in debugfs for debugging RCU implementation.
446
447 Say Y here if you want to enable RCU tracing
448 Say N if you are unsure.
449
450config RCU_FANOUT 444config RCU_FANOUT
451 int "Tree-based hierarchical RCU fanout value" 445 int "Tree-based hierarchical RCU fanout value"
452 range 2 64 if 64BIT 446 range 2 64 if 64BIT
@@ -467,6 +461,33 @@ config RCU_FANOUT
467 Select a specific number if testing RCU itself. 461 Select a specific number if testing RCU itself.
468 Take the default if unsure. 462 Take the default if unsure.
469 463
464config RCU_FANOUT_LEAF
465 int "Tree-based hierarchical RCU leaf-level fanout value"
466 range 2 RCU_FANOUT if 64BIT
467 range 2 RCU_FANOUT if !64BIT
468 depends on TREE_RCU || TREE_PREEMPT_RCU
469 default 16
470 help
471 This option controls the leaf-level fanout of hierarchical
472 implementations of RCU, and allows trading off cache misses
473 against lock contention. Systems that synchronize their
474 scheduling-clock interrupts for energy-efficiency reasons will
475 want the default because the smaller leaf-level fanout keeps
476 lock contention levels acceptably low. Very large systems
477 (hundreds or thousands of CPUs) will instead want to set this
478 value to the maximum value possible in order to reduce the
479 number of cache misses incurred during RCU's grace-period
480 initialization. These systems tend to run CPU-bound, and thus
481 are not helped by synchronized interrupts, and thus tend to
482 skew them, which reduces lock contention enough that large
483 leaf-level fanouts work well.
484
485 Select a specific number if testing RCU itself.
486
487 Select the maximum permissible value for large systems.
488
489 Take the default if unsure.
490
470config RCU_FANOUT_EXACT 491config RCU_FANOUT_EXACT
471 bool "Disable tree-based hierarchical RCU auto-balancing" 492 bool "Disable tree-based hierarchical RCU auto-balancing"
472 depends on TREE_RCU || TREE_PREEMPT_RCU 493 depends on TREE_RCU || TREE_PREEMPT_RCU
@@ -524,10 +545,25 @@ config RCU_BOOST_PRIO
524 depends on RCU_BOOST 545 depends on RCU_BOOST
525 default 1 546 default 1
526 help 547 help
527 This option specifies the real-time priority to which preempted 548 This option specifies the real-time priority to which long-term
528 RCU readers are to be boosted. If you are working with CPU-bound 549 preempted RCU readers are to be boosted. If you are working
529 real-time applications, you should specify a priority higher then 550 with a real-time application that has one or more CPU-bound
530 the highest-priority CPU-bound application. 551 threads running at a real-time priority level, you should set
552 RCU_BOOST_PRIO to a priority higher then the highest-priority
553 real-time CPU-bound thread. The default RCU_BOOST_PRIO value
554 of 1 is appropriate in the common case, which is real-time
555 applications that do not have any CPU-bound threads.
556
557 Some real-time applications might not have a single real-time
558 thread that saturates a given CPU, but instead might have
559 multiple real-time threads that, taken together, fully utilize
560 that CPU. In this case, you should set RCU_BOOST_PRIO to
561 a priority higher than the lowest-priority thread that is
562 conspiring to prevent the CPU from running any non-real-time
563 tasks. For example, if one thread at priority 10 and another
564 thread at priority 5 are between themselves fully consuming
565 the CPU time on a given CPU, then RCU_BOOST_PRIO should be
566 set to priority 6 or higher.
531 567
532 Specify the real-time priority, or take the default if unsure. 568 Specify the real-time priority, or take the default if unsure.
533 569
@@ -1165,7 +1201,7 @@ menu "Kernel Performance Events And Counters"
1165 1201
1166config PERF_EVENTS 1202config PERF_EVENTS
1167 bool "Kernel performance events and counters" 1203 bool "Kernel performance events and counters"
1168 default y if (PROFILING || PERF_COUNTERS) 1204 default y if PROFILING
1169 depends on HAVE_PERF_EVENTS 1205 depends on HAVE_PERF_EVENTS
1170 select ANON_INODES 1206 select ANON_INODES
1171 select IRQ_WORK 1207 select IRQ_WORK
@@ -1192,18 +1228,6 @@ config PERF_EVENTS
1192 1228
1193 Say Y if unsure. 1229 Say Y if unsure.
1194 1230
1195config PERF_COUNTERS
1196 bool "Kernel performance counters (old config option)"
1197 depends on HAVE_PERF_EVENTS
1198 help
1199 This config has been obsoleted by the PERF_EVENTS
1200 config option - please see that one for details.
1201
1202 It has no effect on the kernel whether you enable
1203 it or not, it is a compatibility placeholder.
1204
1205 Say N if unsure.
1206
1207config DEBUG_PERF_USE_VMALLOC 1231config DEBUG_PERF_USE_VMALLOC
1208 default n 1232 default n
1209 bool "Debug: use vmalloc to back perf mmap() buffers" 1233 bool "Debug: use vmalloc to back perf mmap() buffers"
@@ -1423,8 +1447,8 @@ endif # MODULES
1423config INIT_ALL_POSSIBLE 1447config INIT_ALL_POSSIBLE
1424 bool 1448 bool
1425 help 1449 help
1426 Back when each arch used to define their own cpu_online_map and 1450 Back when each arch used to define their own cpu_online_mask and
1427 cpu_possible_map, some of them chose to initialize cpu_possible_map 1451 cpu_possible_mask, some of them chose to initialize cpu_possible_mask
1428 with all 1s, and others with all 0s. When they were centralised, 1452 with all 1s, and others with all 0s. When they were centralised,
1429 it was better to provide this option than to break all the archs 1453 it was better to provide this option than to break all the archs
1430 and have several arch maintainers pursuing me down dark alleys. 1454 and have several arch maintainers pursuing me down dark alleys.
diff --git a/init/Makefile b/init/Makefile
index 0bf677aa087..7bc47ee31c3 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -10,6 +10,10 @@ obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
10endif 10endif
11obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o 11obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
12 12
13ifneq ($(CONFIG_ARCH_INIT_TASK),y)
14obj-y += init_task.o
15endif
16
13mounts-y := do_mounts.o 17mounts-y := do_mounts.o
14mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o 18mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
15mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 19mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
diff --git a/init/calibrate.c b/init/calibrate.c
index 5f117ca9e06..fda0a7b0f06 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -267,7 +267,8 @@ void __cpuinit calibrate_delay(void)
267 267
268 if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { 268 if (per_cpu(cpu_loops_per_jiffy, this_cpu)) {
269 lpj = per_cpu(cpu_loops_per_jiffy, this_cpu); 269 lpj = per_cpu(cpu_loops_per_jiffy, this_cpu);
270 pr_info("Calibrating delay loop (skipped) " 270 if (!printed)
271 pr_info("Calibrating delay loop (skipped) "
271 "already calibrated this CPU"); 272 "already calibrated this CPU");
272 } else if (preset_lpj) { 273 } else if (preset_lpj) {
273 lpj = preset_lpj; 274 lpj = preset_lpj;
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2974c8b3b35..42b0707c348 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -373,8 +373,8 @@ retry:
373#ifdef CONFIG_BLOCK 373#ifdef CONFIG_BLOCK
374 __bdevname(ROOT_DEV, b); 374 __bdevname(ROOT_DEV, b);
375#endif 375#endif
376 printk("VFS: Cannot open root device \"%s\" or %s\n", 376 printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
377 root_device_name, b); 377 root_device_name, b, err);
378 printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); 378 printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
379 379
380 printk_all_partitions(); 380 printk_all_partitions();
@@ -472,7 +472,7 @@ void __init change_floppy(char *fmt, ...)
472void __init mount_root(void) 472void __init mount_root(void)
473{ 473{
474#ifdef CONFIG_ROOT_NFS 474#ifdef CONFIG_ROOT_NFS
475 if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) { 475 if (ROOT_DEV == Root_NFS) {
476 if (mount_nfs_root()) 476 if (mount_nfs_root())
477 return; 477 return;
478 478
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 3098a38f3ae..9047330c73e 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -2,7 +2,6 @@
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/fs.h> 3#include <linux/fs.h>
4#include <linux/minix_fs.h> 4#include <linux/minix_fs.h>
5#include <linux/ext2_fs.h>
6#include <linux/romfs_fs.h> 5#include <linux/romfs_fs.h>
7#include <linux/initrd.h> 6#include <linux/initrd.h>
8#include <linux/sched.h> 7#include <linux/sched.h>
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 887629e24c5..6212586df29 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -54,20 +54,19 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
54{ 54{
55 const int size = 512; 55 const int size = 512;
56 struct minix_super_block *minixsb; 56 struct minix_super_block *minixsb;
57 struct ext2_super_block *ext2sb;
58 struct romfs_super_block *romfsb; 57 struct romfs_super_block *romfsb;
59 struct cramfs_super *cramfsb; 58 struct cramfs_super *cramfsb;
60 struct squashfs_super_block *squashfsb; 59 struct squashfs_super_block *squashfsb;
61 int nblocks = -1; 60 int nblocks = -1;
62 unsigned char *buf; 61 unsigned char *buf;
63 const char *compress_name; 62 const char *compress_name;
63 unsigned long n;
64 64
65 buf = kmalloc(size, GFP_KERNEL); 65 buf = kmalloc(size, GFP_KERNEL);
66 if (!buf) 66 if (!buf)
67 return -ENOMEM; 67 return -ENOMEM;
68 68
69 minixsb = (struct minix_super_block *) buf; 69 minixsb = (struct minix_super_block *) buf;
70 ext2sb = (struct ext2_super_block *) buf;
71 romfsb = (struct romfs_super_block *) buf; 70 romfsb = (struct romfs_super_block *) buf;
72 cramfsb = (struct cramfs_super *) buf; 71 cramfsb = (struct cramfs_super *) buf;
73 squashfsb = (struct squashfs_super_block *) buf; 72 squashfsb = (struct squashfs_super_block *) buf;
@@ -150,12 +149,12 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
150 } 149 }
151 150
152 /* Try ext2 */ 151 /* Try ext2 */
153 if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) { 152 n = ext2_image_size(buf);
153 if (n) {
154 printk(KERN_NOTICE 154 printk(KERN_NOTICE
155 "RAMDISK: ext2 filesystem found at block %d\n", 155 "RAMDISK: ext2 filesystem found at block %d\n",
156 start_block); 156 start_block);
157 nblocks = le32_to_cpu(ext2sb->s_blocks_count) << 157 nblocks = n;
158 le32_to_cpu(ext2sb->s_log_block_size);
159 goto done; 158 goto done;
160 } 159 }
161 160
@@ -178,7 +177,7 @@ int __init rd_load_image(char *from)
178 char *buf = NULL; 177 char *buf = NULL;
179 unsigned short rotate = 0; 178 unsigned short rotate = 0;
180 decompress_fn decompressor = NULL; 179 decompress_fn decompressor = NULL;
181#if !defined(CONFIG_S390) && !defined(CONFIG_PPC_ISERIES) 180#if !defined(CONFIG_S390)
182 char rotator[4] = { '|' , '/' , '-' , '\\' }; 181 char rotator[4] = { '|' , '/' , '-' , '\\' };
183#endif 182#endif
184 183
@@ -264,7 +263,7 @@ int __init rd_load_image(char *from)
264 } 263 }
265 sys_read(in_fd, buf, BLOCK_SIZE); 264 sys_read(in_fd, buf, BLOCK_SIZE);
266 sys_write(out_fd, buf, BLOCK_SIZE); 265 sys_write(out_fd, buf, BLOCK_SIZE);
267#if !defined(CONFIG_S390) && !defined(CONFIG_PPC_ISERIES) 266#if !defined(CONFIG_S390)
268 if (!(i % 16)) { 267 if (!(i % 16)) {
269 printk("%c\b", rotator[rotate & 0x3]); 268 printk("%c\b", rotator[rotate & 0x3]);
270 rotate++; 269 rotate++;
diff --git a/init/init_task.c b/init/init_task.c
new file mode 100644
index 00000000000..8b2f3996b03
--- /dev/null
+++ b/init/init_task.c
@@ -0,0 +1,24 @@
1#include <linux/init_task.h>
2#include <linux/export.h>
3#include <linux/mqueue.h>
4#include <linux/sched.h>
5#include <linux/init.h>
6#include <linux/fs.h>
7#include <linux/mm.h>
8
9#include <asm/pgtable.h>
10#include <asm/uaccess.h>
11
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14
15/* Initial task structure */
16struct task_struct init_task = INIT_TASK(init_task);
17EXPORT_SYMBOL(init_task);
18
19/*
20 * Initial thread structure. Alignment of this is handled by a special
21 * linker map entry.
22 */
23union thread_union init_thread_union __init_task_data =
24 { INIT_THREAD_INFO(init_task) };
diff --git a/init/main.c b/init/main.c
index ff49a6dacfb..1ca6b32c482 100644
--- a/init/main.c
+++ b/init/main.c
@@ -87,7 +87,6 @@ extern void mca_init(void);
87extern void sbus_init(void); 87extern void sbus_init(void);
88extern void prio_tree_init(void); 88extern void prio_tree_init(void);
89extern void radix_tree_init(void); 89extern void radix_tree_init(void);
90extern void free_initmem(void);
91#ifndef CONFIG_DEBUG_RODATA 90#ifndef CONFIG_DEBUG_RODATA
92static inline void mark_rodata_ro(void) { } 91static inline void mark_rodata_ro(void) { }
93#endif 92#endif
@@ -226,13 +225,9 @@ static int __init loglevel(char *str)
226 225
227early_param("loglevel", loglevel); 226early_param("loglevel", loglevel);
228 227
229/* 228/* Change NUL term back to "=", to make "param" the whole string. */
230 * Unknown boot options get handed to init, unless they look like 229static int __init repair_env_string(char *param, char *val, const char *unused)
231 * unused parameters (modprobe will find them in /proc/cmdline).
232 */
233static int __init unknown_bootoption(char *param, char *val)
234{ 230{
235 /* Change NUL term back to "=", to make "param" the whole string. */
236 if (val) { 231 if (val) {
237 /* param=val or param="val"? */ 232 /* param=val or param="val"? */
238 if (val == param+strlen(param)+1) 233 if (val == param+strlen(param)+1)
@@ -244,6 +239,16 @@ static int __init unknown_bootoption(char *param, char *val)
244 } else 239 } else
245 BUG(); 240 BUG();
246 } 241 }
242 return 0;
243}
244
245/*
246 * Unknown boot options get handed to init, unless they look like
247 * unused parameters (modprobe will find them in /proc/cmdline).
248 */
249static int __init unknown_bootoption(char *param, char *val, const char *unused)
250{
251 repair_env_string(param, val, unused);
247 252
248 /* Handle obsolete-style parameters */ 253 /* Handle obsolete-style parameters */
249 if (obsolete_checksetup(param)) 254 if (obsolete_checksetup(param))
@@ -374,16 +379,13 @@ static noinline void __init_refok rest_init(void)
374 * at least once to get things moving: 379 * at least once to get things moving:
375 */ 380 */
376 init_idle_bootup_task(current); 381 init_idle_bootup_task(current);
377 preempt_enable_no_resched(); 382 schedule_preempt_disabled();
378 schedule();
379
380 /* Call into cpu_idle with preempt disabled */ 383 /* Call into cpu_idle with preempt disabled */
381 preempt_disable();
382 cpu_idle(); 384 cpu_idle();
383} 385}
384 386
385/* Check for early params. */ 387/* Check for early params. */
386static int __init do_early_param(char *param, char *val) 388static int __init do_early_param(char *param, char *val, const char *unused)
387{ 389{
388 const struct obs_kernel_param *p; 390 const struct obs_kernel_param *p;
389 391
@@ -403,7 +405,7 @@ static int __init do_early_param(char *param, char *val)
403 405
404void __init parse_early_options(char *cmdline) 406void __init parse_early_options(char *cmdline)
405{ 407{
406 parse_args("early options", cmdline, NULL, 0, do_early_param); 408 parse_args("early options", cmdline, NULL, 0, 0, 0, do_early_param);
407} 409}
408 410
409/* Arch code calls this early on, or if not, just before other parsing. */ 411/* Arch code calls this early on, or if not, just before other parsing. */
@@ -449,8 +451,8 @@ void __init __weak thread_info_cache_init(void)
449static void __init mm_init(void) 451static void __init mm_init(void)
450{ 452{
451 /* 453 /*
452 * page_cgroup requires countinous pages as memmap 454 * page_cgroup requires contiguous pages,
453 * and it's bigger than MAX_ORDER unless SPARSEMEM. 455 * bigger than MAX_ORDER unless SPARSEMEM.
454 */ 456 */
455 page_cgroup_init_flatmem(); 457 page_cgroup_init_flatmem();
456 mem_init(); 458 mem_init();
@@ -506,7 +508,7 @@ asmlinkage void __init start_kernel(void)
506 parse_early_param(); 508 parse_early_param();
507 parse_args("Booting kernel", static_command_line, __start___param, 509 parse_args("Booting kernel", static_command_line, __start___param,
508 __stop___param - __start___param, 510 __stop___param - __start___param,
509 &unknown_bootoption); 511 0, 0, &unknown_bootoption);
510 512
511 jump_label_init(); 513 jump_label_init();
512 514
@@ -558,9 +560,6 @@ asmlinkage void __init start_kernel(void)
558 early_boot_irqs_disabled = false; 560 early_boot_irqs_disabled = false;
559 local_irq_enable(); 561 local_irq_enable();
560 562
561 /* Interrupts are enabled now so all GFP allocations are safe. */
562 gfp_allowed_mask = __GFP_BITS_MASK;
563
564 kmem_cache_init_late(); 563 kmem_cache_init_late();
565 564
566 /* 565 /*
@@ -702,16 +701,69 @@ int __init_or_module do_one_initcall(initcall_t fn)
702} 701}
703 702
704 703
705extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; 704extern initcall_t __initcall_start[];
706 705extern initcall_t __initcall0_start[];
707static void __init do_initcalls(void) 706extern initcall_t __initcall1_start[];
707extern initcall_t __initcall2_start[];
708extern initcall_t __initcall3_start[];
709extern initcall_t __initcall4_start[];
710extern initcall_t __initcall5_start[];
711extern initcall_t __initcall6_start[];
712extern initcall_t __initcall7_start[];
713extern initcall_t __initcall_end[];
714
715static initcall_t *initcall_levels[] __initdata = {
716 __initcall0_start,
717 __initcall1_start,
718 __initcall2_start,
719 __initcall3_start,
720 __initcall4_start,
721 __initcall5_start,
722 __initcall6_start,
723 __initcall7_start,
724 __initcall_end,
725};
726
727static char *initcall_level_names[] __initdata = {
728 "early",
729 "core",
730 "postcore",
731 "arch",
732 "subsys",
733 "fs",
734 "device",
735 "late",
736};
737
738static void __init do_initcall_level(int level)
708{ 739{
740 extern const struct kernel_param __start___param[], __stop___param[];
709 initcall_t *fn; 741 initcall_t *fn;
710 742
711 for (fn = __early_initcall_end; fn < __initcall_end; fn++) 743 strcpy(static_command_line, saved_command_line);
744 parse_args(initcall_level_names[level],
745 static_command_line, __start___param,
746 __stop___param - __start___param,
747 level, level,
748 &repair_env_string);
749
750 for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
712 do_one_initcall(*fn); 751 do_one_initcall(*fn);
713} 752}
714 753
754static void __init do_initcalls(void)
755{
756 int level;
757
758 for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++) {
759 pr_info("initlevel:%d=%s, %d registered initcalls\n",
760 level, initcall_level_names[level],
761 (int) (initcall_levels[level+1]
762 - initcall_levels[level]));
763 do_initcall_level(level);
764 }
765}
766
715/* 767/*
716 * Ok, the machine is now initialized. None of the devices 768 * Ok, the machine is now initialized. None of the devices
717 * have been touched yet, but the CPU subsystem is up and 769 * have been touched yet, but the CPU subsystem is up and
@@ -735,7 +787,7 @@ static void __init do_pre_smp_initcalls(void)
735{ 787{
736 initcall_t *fn; 788 initcall_t *fn;
737 789
738 for (fn = __initcall_start; fn < __early_initcall_end; fn++) 790 for (fn = __initcall_start; fn < __initcall0_start; fn++)
739 do_one_initcall(*fn); 791 do_one_initcall(*fn);
740} 792}
741 793
@@ -792,6 +844,10 @@ static int __init kernel_init(void * unused)
792 * Wait until kthreadd is all set-up. 844 * Wait until kthreadd is all set-up.
793 */ 845 */
794 wait_for_completion(&kthreadd_done); 846 wait_for_completion(&kthreadd_done);
847
848 /* Now the scheduler is fully set up and can do blocking allocations */
849 gfp_allowed_mask = __GFP_BITS_MASK;
850
795 /* 851 /*
796 * init can allocate pages on any node 852 * init can allocate pages on any node
797 */ 853 */