aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig27
-rw-r--r--init/do_mounts.c1
-rw-r--r--init/do_mounts.h1
-rw-r--r--init/do_mounts_md.c5
-rw-r--r--init/initramfs.c78
-rw-r--r--init/main.c9
6 files changed, 89 insertions, 32 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 69d5190918e5..c52d1d48272a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -531,7 +531,7 @@ config CGROUP_DEVICE
531 531
532config CPUSETS 532config CPUSETS
533 bool "Cpuset support" 533 bool "Cpuset support"
534 depends on SMP && CGROUPS 534 depends on CGROUPS
535 help 535 help
536 This option will let you create and manage CPUSETs which 536 This option will let you create and manage CPUSETs which
537 allow dynamically partitioning a system into sets of CPUs and 537 allow dynamically partitioning a system into sets of CPUs and
@@ -565,7 +565,7 @@ config CGROUP_MEM_RES_CTLR
565 select MM_OWNER 565 select MM_OWNER
566 help 566 help
567 Provides a memory resource controller that manages both anonymous 567 Provides a memory resource controller that manages both anonymous
568 memory and page cache. (See Documentation/controllers/memory.txt) 568 memory and page cache. (See Documentation/cgroups/memory.txt)
569 569
570 Note that setting this option increases fixed memory overhead 570 Note that setting this option increases fixed memory overhead
571 associated with each page of memory in the system. By this, 571 associated with each page of memory in the system. By this,
@@ -597,6 +597,8 @@ config CGROUP_MEM_RES_CTLR_SWAP
597 is disabled by boot option, this will be automatically disabled and 597 is disabled by boot option, this will be automatically disabled and
598 there will be no overhead from this. Even when you set this config=y, 598 there will be no overhead from this. Even when you set this config=y,
599 if boot option "noswapaccount" is set, swap will not be accounted. 599 if boot option "noswapaccount" is set, swap will not be accounted.
600 Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page
601 size is 4096bytes, 512k per 1Gbytes of swap.
600 602
601endif # CGROUPS 603endif # CGROUPS
602 604
@@ -687,7 +689,7 @@ config PID_NS
687 depends on NAMESPACES && EXPERIMENTAL 689 depends on NAMESPACES && EXPERIMENTAL
688 help 690 help
689 Support process id namespaces. This allows having multiple 691 Support process id namespaces. This allows having multiple
690 process with the same pid as long as they are in different 692 processes with the same pid as long as they are in different
691 pid namespaces. This is a building block of containers. 693 pid namespaces. This is a building block of containers.
692 694
693 Unless you want to work with an experimental feature 695 Unless you want to work with an experimental feature
@@ -952,7 +954,7 @@ config COMPAT_BRK
952 Randomizing heap placement makes heap exploits harder, but it 954 Randomizing heap placement makes heap exploits harder, but it
953 also breaks ancient binaries (including anything libc5 based). 955 also breaks ancient binaries (including anything libc5 based).
954 This option changes the bootup default to heap randomization 956 This option changes the bootup default to heap randomization
955 disabled, and can be overriden runtime by setting 957 disabled, and can be overridden at runtime by setting
956 /proc/sys/kernel/randomize_va_space to 2. 958 /proc/sys/kernel/randomize_va_space to 2.
957 959
958 On non-ancient distros (post-2000 ones) N is usually a safe choice. 960 On non-ancient distros (post-2000 ones) N is usually a safe choice.
@@ -1012,6 +1014,20 @@ config MARKERS
1012 1014
1013source "arch/Kconfig" 1015source "arch/Kconfig"
1014 1016
1017config SLOW_WORK
1018 default n
1019 bool
1020 help
1021 The slow work thread pool provides a number of dynamically allocated
1022 threads that can be used by the kernel to perform operations that
1023 take a relatively long time.
1024
1025 An example of this would be CacheFiles doing a path lookup followed
1026 by a series of mkdirs and a create call, all of which have to touch
1027 disk.
1028
1029 See Documentation/slow-work.txt.
1030
1015endmenu # General setup 1031endmenu # General setup
1016 1032
1017config HAVE_GENERIC_DMA_COHERENT 1033config HAVE_GENERIC_DMA_COHERENT
@@ -1026,7 +1042,6 @@ config SLABINFO
1026 1042
1027config RT_MUTEXES 1043config RT_MUTEXES
1028 boolean 1044 boolean
1029 select PLIST
1030 1045
1031config BASE_SMALL 1046config BASE_SMALL
1032 int 1047 int
@@ -1111,7 +1126,7 @@ config INIT_ALL_POSSIBLE
1111 cpu_possible_map, some of them chose to initialize cpu_possible_map 1126 cpu_possible_map, some of them chose to initialize cpu_possible_map
1112 with all 1s, and others with all 0s. When they were centralised, 1127 with all 1s, and others with all 0s. When they were centralised,
1113 it was better to provide this option than to break all the archs 1128 it was better to provide this option than to break all the archs
1114 and have several arch maintainers persuing me down dark alleys. 1129 and have several arch maintainers pursuing me down dark alleys.
1115 1130
1116config STOP_MACHINE 1131config STOP_MACHINE
1117 bool 1132 bool
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8d4ff5afc1d8..dd7ee5f203f3 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -14,6 +14,7 @@
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/async.h> 16#include <linux/async.h>
17#include <linux/fs_struct.h>
17 18
18#include <linux/nfs_fs.h> 19#include <linux/nfs_fs.h>
19#include <linux/nfs_fs_sb.h> 20#include <linux/nfs_fs_sb.h>
diff --git a/init/do_mounts.h b/init/do_mounts.h
index 9aa968d54329..f5b978a9bb92 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -1,4 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/blkdev.h>
2#include <linux/init.h> 3#include <linux/init.h>
3#include <linux/syscalls.h> 4#include <linux/syscalls.h>
4#include <linux/unistd.h> 5#include <linux/unistd.h>
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 9bdddbcb3d6a..69aebbf8fd2d 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -1,5 +1,6 @@
1#include <linux/delay.h> 1#include <linux/delay.h>
2#include <linux/raid/md.h> 2#include <linux/raid/md_u.h>
3#include <linux/raid/md_p.h>
3 4
4#include "do_mounts.h" 5#include "do_mounts.h"
5 6
@@ -112,8 +113,6 @@ static int __init md_setup(char *str)
112 return 1; 113 return 1;
113} 114}
114 115
115#define MdpMinorShift 6
116
117static void __init md_setup_drive(void) 116static void __init md_setup_drive(void)
118{ 117{
119 int minor, i, ent, partitioned; 118 int minor, i, ent, partitioned;
diff --git a/init/initramfs.c b/init/initramfs.c
index 7dcde7ea6603..80cd713f6cc5 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -5,6 +5,7 @@
5#include <linux/fcntl.h> 5#include <linux/fcntl.h>
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/dirent.h>
8#include <linux/syscalls.h> 9#include <linux/syscalls.h>
9#include <linux/utime.h> 10#include <linux/utime.h>
10 11
@@ -166,8 +167,6 @@ static __initdata char *victim;
166static __initdata unsigned count; 167static __initdata unsigned count;
167static __initdata loff_t this_header, next_header; 168static __initdata loff_t this_header, next_header;
168 169
169static __initdata int dry_run;
170
171static inline void __init eat(unsigned n) 170static inline void __init eat(unsigned n)
172{ 171{
173 victim += n; 172 victim += n;
@@ -229,10 +228,6 @@ static int __init do_header(void)
229 parse_header(collected); 228 parse_header(collected);
230 next_header = this_header + N_ALIGN(name_len) + body_len; 229 next_header = this_header + N_ALIGN(name_len) + body_len;
231 next_header = (next_header + 3) & ~3; 230 next_header = (next_header + 3) & ~3;
232 if (dry_run) {
233 read_into(name_buf, N_ALIGN(name_len), GotName);
234 return 0;
235 }
236 state = SkipIt; 231 state = SkipIt;
237 if (name_len <= 0 || name_len > PATH_MAX) 232 if (name_len <= 0 || name_len > PATH_MAX)
238 return 0; 233 return 0;
@@ -303,8 +298,6 @@ static int __init do_name(void)
303 free_hash(); 298 free_hash();
304 return 0; 299 return 0;
305 } 300 }
306 if (dry_run)
307 return 0;
308 clean_path(collected, mode); 301 clean_path(collected, mode);
309 if (S_ISREG(mode)) { 302 if (S_ISREG(mode)) {
310 int ml = maybe_link(); 303 int ml = maybe_link();
@@ -417,14 +410,13 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */
417 410
418#include <linux/decompress/generic.h> 411#include <linux/decompress/generic.h>
419 412
420static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) 413static char * __init unpack_to_rootfs(char *buf, unsigned len)
421{ 414{
422 int written; 415 int written;
423 decompress_fn decompress; 416 decompress_fn decompress;
424 const char *compress_name; 417 const char *compress_name;
425 static __initdata char msg_buf[64]; 418 static __initdata char msg_buf[64];
426 419
427 dry_run = check_only;
428 header_buf = kmalloc(110, GFP_KERNEL); 420 header_buf = kmalloc(110, GFP_KERNEL);
429 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); 421 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
430 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL); 422 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
@@ -523,26 +515,76 @@ skip:
523 initrd_end = 0; 515 initrd_end = 0;
524} 516}
525 517
518#define BUF_SIZE 1024
519static void __init clean_rootfs(void)
520{
521 int fd;
522 void *buf;
523 struct linux_dirent64 *dirp;
524 int count;
525
526 fd = sys_open("/", O_RDONLY, 0);
527 WARN_ON(fd < 0);
528 if (fd < 0)
529 return;
530 buf = kzalloc(BUF_SIZE, GFP_KERNEL);
531 WARN_ON(!buf);
532 if (!buf) {
533 sys_close(fd);
534 return;
535 }
536
537 dirp = buf;
538 count = sys_getdents64(fd, dirp, BUF_SIZE);
539 while (count > 0) {
540 while (count > 0) {
541 struct stat st;
542 int ret;
543
544 ret = sys_newlstat(dirp->d_name, &st);
545 WARN_ON_ONCE(ret);
546 if (!ret) {
547 if (S_ISDIR(st.st_mode))
548 sys_rmdir(dirp->d_name);
549 else
550 sys_unlink(dirp->d_name);
551 }
552
553 count -= dirp->d_reclen;
554 dirp = (void *)dirp + dirp->d_reclen;
555 }
556 dirp = buf;
557 memset(buf, 0, BUF_SIZE);
558 count = sys_getdents64(fd, dirp, BUF_SIZE);
559 }
560
561 sys_close(fd);
562 kfree(buf);
563}
564
526static int __init populate_rootfs(void) 565static int __init populate_rootfs(void)
527{ 566{
528 char *err = unpack_to_rootfs(__initramfs_start, 567 char *err = unpack_to_rootfs(__initramfs_start,
529 __initramfs_end - __initramfs_start, 0); 568 __initramfs_end - __initramfs_start);
530 if (err) 569 if (err)
531 panic(err); /* Failed to decompress INTERNAL initramfs */ 570 panic(err); /* Failed to decompress INTERNAL initramfs */
532 if (initrd_start) { 571 if (initrd_start) {
533#ifdef CONFIG_BLK_DEV_RAM 572#ifdef CONFIG_BLK_DEV_RAM
534 int fd; 573 int fd;
535 printk(KERN_INFO "checking if image is initramfs..."); 574 printk(KERN_INFO "checking if image is initramfs...\n");
536 err = unpack_to_rootfs((char *)initrd_start, 575 err = unpack_to_rootfs((char *)initrd_start,
537 initrd_end - initrd_start, 1); 576 initrd_end - initrd_start);
538 if (!err) { 577 if (!err) {
539 printk(" it is\n"); 578 printk(KERN_INFO "rootfs image is initramfs; unpacking...\n");
540 unpack_to_rootfs((char *)initrd_start,
541 initrd_end - initrd_start, 0);
542 free_initrd(); 579 free_initrd();
543 return 0; 580 return 0;
581 } else {
582 clean_rootfs();
583 unpack_to_rootfs(__initramfs_start,
584 __initramfs_end - __initramfs_start);
544 } 585 }
545 printk("it isn't (%s); looks like an initrd\n", err); 586 printk(KERN_INFO "rootfs image is not initramfs (%s)"
587 "; looks like an initrd\n", err);
546 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); 588 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
547 if (fd >= 0) { 589 if (fd >= 0) {
548 sys_write(fd, (char *)initrd_start, 590 sys_write(fd, (char *)initrd_start,
@@ -553,7 +595,7 @@ static int __init populate_rootfs(void)
553#else 595#else
554 printk(KERN_INFO "Unpacking initramfs..."); 596 printk(KERN_INFO "Unpacking initramfs...");
555 err = unpack_to_rootfs((char *)initrd_start, 597 err = unpack_to_rootfs((char *)initrd_start,
556 initrd_end - initrd_start, 0); 598 initrd_end - initrd_start);
557 if (err) { 599 if (err) {
558 printk(" failed!\n"); 600 printk(" failed!\n");
559 printk(KERN_EMERG "%s\n", err); 601 printk(KERN_EMERG "%s\n", err);
diff --git a/init/main.c b/init/main.c
index 20d784ab5ef8..3585f073d636 100644
--- a/init/main.c
+++ b/init/main.c
@@ -408,8 +408,7 @@ static void __init smp_init(void)
408 * Set up the current CPU as possible to migrate to. 408 * Set up the current CPU as possible to migrate to.
409 * The other ones will be done by cpu_up/cpu_down() 409 * The other ones will be done by cpu_up/cpu_down()
410 */ 410 */
411 cpu = smp_processor_id(); 411 set_cpu_active(smp_processor_id(), true);
412 cpu_set(cpu, cpu_active_map);
413 412
414 /* FIXME: This should be done in userspace --RR */ 413 /* FIXME: This should be done in userspace --RR */
415 for_each_present_cpu(cpu) { 414 for_each_present_cpu(cpu) {
@@ -772,6 +771,7 @@ static void __init do_basic_setup(void)
772{ 771{
773 rcu_init_sched(); /* needed by module_init stage. */ 772 rcu_init_sched(); /* needed by module_init stage. */
774 init_workqueues(); 773 init_workqueues();
774 cpuset_init_smp();
775 usermodehelper_init(); 775 usermodehelper_init();
776 driver_init(); 776 driver_init();
777 init_irq_proc(); 777 init_irq_proc();
@@ -796,6 +796,7 @@ static void run_init_process(char *init_filename)
796 * makes it inline to init() and it becomes part of init.text section 796 * makes it inline to init() and it becomes part of init.text section
797 */ 797 */
798static noinline int init_post(void) 798static noinline int init_post(void)
799 __releases(kernel_lock)
799{ 800{
800 /* need to finish all async __init code before freeing the memory */ 801 /* need to finish all async __init code before freeing the memory */
801 async_synchronize_full(); 802 async_synchronize_full();
@@ -844,7 +845,7 @@ static int __init kernel_init(void * unused)
844 /* 845 /*
845 * init can run on any cpu. 846 * init can run on any cpu.
846 */ 847 */
847 set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR); 848 set_cpus_allowed_ptr(current, cpu_all_mask);
848 /* 849 /*
849 * Tell the world that we're going to be the grim 850 * Tell the world that we're going to be the grim
850 * reaper of innocent orphaned children. 851 * reaper of innocent orphaned children.
@@ -865,8 +866,6 @@ static int __init kernel_init(void * unused)
865 smp_init(); 866 smp_init();
866 sched_init_smp(); 867 sched_init_smp();
867 868
868 cpuset_init_smp();
869
870 do_basic_setup(); 869 do_basic_setup();
871 870
872 /* 871 /*