aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-02 14:02:55 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 14:03:08 -0400
commitc9494727cf293ae2ec66af57547a3e79c724fec2 (patch)
tree44ae197b64fa7530ee695a90ad31326dda06f1e1 /init
parent6427462bfa50f50dc6c088c07037264fcc73eca1 (diff)
parent42be79e37e264557f12860fa4cc84b4de3685954 (diff)
Merge branch 'linus' into sched/core
Merge reason: update to latest upstream Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig1
-rw-r--r--init/do_mounts_initrd.c4
-rw-r--r--init/initramfs.c12
-rw-r--r--init/main.c36
4 files changed, 33 insertions, 20 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 089a230e5652..eb77e8ccde1c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -463,6 +463,7 @@ config HAVE_UNSTABLE_SCHED_CLOCK
463 463
464menuconfig CGROUPS 464menuconfig CGROUPS
465 boolean "Control Group support" 465 boolean "Control Group support"
466 depends on EVENTFD
466 help 467 help
467 This option adds support for grouping sets of processes together, for 468 This option adds support for grouping sets of processes together, for
468 use with process control subsystems such as Cpusets, CFS, memory 469 use with process control subsystems such as Cpusets, CFS, memory
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 614241b5200c..2b108538d0d9 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -30,11 +30,7 @@ static int __init do_linuxrc(void * shell)
30 extern char * envp_init[]; 30 extern char * envp_init[];
31 31
32 sys_close(old_fd);sys_close(root_fd); 32 sys_close(old_fd);sys_close(root_fd);
33 sys_close(0);sys_close(1);sys_close(2);
34 sys_setsid(); 33 sys_setsid();
35 (void) sys_open("/dev/console",O_RDWR,0);
36 (void) sys_dup(0);
37 (void) sys_dup(0);
38 return kernel_execve(shell, argv, envp_init); 34 return kernel_execve(shell, argv, envp_init);
39} 35}
40 36
diff --git a/init/initramfs.c b/init/initramfs.c
index b37d34beb90b..37d3859b1b32 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -525,7 +525,7 @@ static void __init clean_rootfs(void)
525 int fd; 525 int fd;
526 void *buf; 526 void *buf;
527 struct linux_dirent64 *dirp; 527 struct linux_dirent64 *dirp;
528 int count; 528 int num;
529 529
530 fd = sys_open("/", O_RDONLY, 0); 530 fd = sys_open("/", O_RDONLY, 0);
531 WARN_ON(fd < 0); 531 WARN_ON(fd < 0);
@@ -539,9 +539,9 @@ static void __init clean_rootfs(void)
539 } 539 }
540 540
541 dirp = buf; 541 dirp = buf;
542 count = sys_getdents64(fd, dirp, BUF_SIZE); 542 num = sys_getdents64(fd, dirp, BUF_SIZE);
543 while (count > 0) { 543 while (num > 0) {
544 while (count > 0) { 544 while (num > 0) {
545 struct stat st; 545 struct stat st;
546 int ret; 546 int ret;
547 547
@@ -554,12 +554,12 @@ static void __init clean_rootfs(void)
554 sys_unlink(dirp->d_name); 554 sys_unlink(dirp->d_name);
555 } 555 }
556 556
557 count -= dirp->d_reclen; 557 num -= dirp->d_reclen;
558 dirp = (void *)dirp + dirp->d_reclen; 558 dirp = (void *)dirp + dirp->d_reclen;
559 } 559 }
560 dirp = buf; 560 dirp = buf;
561 memset(buf, 0, BUF_SIZE); 561 memset(buf, 0, BUF_SIZE);
562 count = sys_getdents64(fd, dirp, BUF_SIZE); 562 num = sys_getdents64(fd, dirp, BUF_SIZE);
563 } 563 }
564 564
565 sys_close(fd); 565 sys_close(fd);
diff --git a/init/main.c b/init/main.c
index c75dcd6eef09..cbead27caefc 100644
--- a/init/main.c
+++ b/init/main.c
@@ -149,6 +149,20 @@ static int __init nosmp(char *str)
149 149
150early_param("nosmp", nosmp); 150early_param("nosmp", nosmp);
151 151
152/* this is hard limit */
153static int __init nrcpus(char *str)
154{
155 int nr_cpus;
156
157 get_option(&str, &nr_cpus);
158 if (nr_cpus > 0 && nr_cpus < nr_cpu_ids)
159 nr_cpu_ids = nr_cpus;
160
161 return 0;
162}
163
164early_param("nr_cpus", nrcpus);
165
152static int __init maxcpus(char *str) 166static int __init maxcpus(char *str)
153{ 167{
154 get_option(&str, &setup_max_cpus); 168 get_option(&str, &setup_max_cpus);
@@ -160,7 +174,7 @@ static int __init maxcpus(char *str)
160 174
161early_param("maxcpus", maxcpus); 175early_param("maxcpus", maxcpus);
162#else 176#else
163const unsigned int setup_max_cpus = NR_CPUS; 177static const unsigned int setup_max_cpus = NR_CPUS;
164#endif 178#endif
165 179
166/* 180/*
@@ -586,6 +600,7 @@ asmlinkage void __init start_kernel(void)
586 local_irq_disable(); 600 local_irq_disable();
587 } 601 }
588 rcu_init(); 602 rcu_init();
603 radix_tree_init();
589 /* init some links before init_ISA_irqs() */ 604 /* init some links before init_ISA_irqs() */
590 early_irq_init(); 605 early_irq_init();
591 init_IRQ(); 606 init_IRQ();
@@ -603,7 +618,7 @@ asmlinkage void __init start_kernel(void)
603 local_irq_enable(); 618 local_irq_enable();
604 619
605 /* Interrupts are enabled now so all GFP allocations are safe. */ 620 /* Interrupts are enabled now so all GFP allocations are safe. */
606 set_gfp_allowed_mask(__GFP_BITS_MASK); 621 gfp_allowed_mask = __GFP_BITS_MASK;
607 622
608 kmem_cache_init_late(); 623 kmem_cache_init_late();
609 624
@@ -659,7 +674,6 @@ asmlinkage void __init start_kernel(void)
659 proc_caches_init(); 674 proc_caches_init();
660 buffer_init(); 675 buffer_init();
661 key_init(); 676 key_init();
662 radix_tree_init();
663 security_init(); 677 security_init();
664 vfs_caches_init(totalram_pages); 678 vfs_caches_init(totalram_pages);
665 signals_init(); 679 signals_init();
@@ -808,11 +822,6 @@ static noinline int init_post(void)
808 system_state = SYSTEM_RUNNING; 822 system_state = SYSTEM_RUNNING;
809 numa_default_policy(); 823 numa_default_policy();
810 824
811 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
812 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
813
814 (void) sys_dup(0);
815 (void) sys_dup(0);
816 825
817 current->signal->flags |= SIGNAL_UNKILLABLE; 826 current->signal->flags |= SIGNAL_UNKILLABLE;
818 827
@@ -838,7 +847,8 @@ static noinline int init_post(void)
838 run_init_process("/bin/init"); 847 run_init_process("/bin/init");
839 run_init_process("/bin/sh"); 848 run_init_process("/bin/sh");
840 849
841 panic("No init found. Try passing init= option to kernel."); 850 panic("No init found. Try passing init= option to kernel. "
851 "See Linux Documentation/init.txt for guidance.");
842} 852}
843 853
844static int __init kernel_init(void * unused) 854static int __init kernel_init(void * unused)
@@ -848,7 +858,7 @@ static int __init kernel_init(void * unused)
848 /* 858 /*
849 * init can allocate pages on any node 859 * init can allocate pages on any node
850 */ 860 */
851 set_mems_allowed(node_possible_map); 861 set_mems_allowed(node_states[N_HIGH_MEMORY]);
852 /* 862 /*
853 * init can run on any cpu. 863 * init can run on any cpu.
854 */ 864 */
@@ -875,6 +885,12 @@ static int __init kernel_init(void * unused)
875 885
876 do_basic_setup(); 886 do_basic_setup();
877 887
888 /* Open the /dev/console on the rootfs, this should never fail */
889 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
890 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
891
892 (void) sys_dup(0);
893 (void) sys_dup(0);
878 /* 894 /*
879 * check if there is an early userspace init. If yes, let it do all 895 * check if there is an early userspace init. If yes, let it do all
880 * the work 896 * the work