aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig24
-rw-r--r--init/main.c61
2 files changed, 26 insertions, 59 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 05e932ef5169..24932b9c03e8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1147,30 +1147,6 @@ config TRACEPOINTS
1147 1147
1148source "arch/Kconfig" 1148source "arch/Kconfig"
1149 1149
1150config SLOW_WORK
1151 default n
1152 bool
1153 help
1154 The slow work thread pool provides a number of dynamically allocated
1155 threads that can be used by the kernel to perform operations that
1156 take a relatively long time.
1157
1158 An example of this would be CacheFiles doing a path lookup followed
1159 by a series of mkdirs and a create call, all of which have to touch
1160 disk.
1161
1162 See Documentation/slow-work.txt.
1163
1164config SLOW_WORK_DEBUG
1165 bool "Slow work debugging through debugfs"
1166 default n
1167 depends on SLOW_WORK && DEBUG_FS
1168 help
1169 Display the contents of the slow work run queue through debugfs,
1170 including items currently executing.
1171
1172 See Documentation/slow-work.txt.
1173
1174endmenu # General setup 1150endmenu # General setup
1175 1151
1176config HAVE_GENERIC_DMA_COHERENT 1152config HAVE_GENERIC_DMA_COHERENT
diff --git a/init/main.c b/init/main.c
index a42fdf4aeba9..86cbfd085b01 100644
--- a/init/main.c
+++ b/init/main.c
@@ -32,7 +32,6 @@
32#include <linux/start_kernel.h> 32#include <linux/start_kernel.h>
33#include <linux/security.h> 33#include <linux/security.h>
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/workqueue.h>
36#include <linux/profile.h> 35#include <linux/profile.h>
37#include <linux/rcupdate.h> 36#include <linux/rcupdate.h>
38#include <linux/moduleparam.h> 37#include <linux/moduleparam.h>
@@ -66,11 +65,9 @@
66#include <linux/ftrace.h> 65#include <linux/ftrace.h>
67#include <linux/async.h> 66#include <linux/async.h>
68#include <linux/kmemcheck.h> 67#include <linux/kmemcheck.h>
69#include <linux/kmemtrace.h>
70#include <linux/sfi.h> 68#include <linux/sfi.h>
71#include <linux/shmem_fs.h> 69#include <linux/shmem_fs.h>
72#include <linux/slab.h> 70#include <linux/slab.h>
73#include <trace/boot.h>
74 71
75#include <asm/io.h> 72#include <asm/io.h>
76#include <asm/bugs.h> 73#include <asm/bugs.h>
@@ -444,7 +441,6 @@ static noinline void __init_refok rest_init(void)
444 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); 441 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
445 rcu_read_unlock(); 442 rcu_read_unlock();
446 complete(&kthreadd_done); 443 complete(&kthreadd_done);
447 unlock_kernel();
448 444
449 /* 445 /*
450 * The boot idle thread must execute schedule() 446 * The boot idle thread must execute schedule()
@@ -532,6 +528,7 @@ static void __init mm_init(void)
532 page_cgroup_init_flatmem(); 528 page_cgroup_init_flatmem();
533 mem_init(); 529 mem_init();
534 kmem_cache_init(); 530 kmem_cache_init();
531 percpu_init_late();
535 pgtable_cache_init(); 532 pgtable_cache_init();
536 vmalloc_init(); 533 vmalloc_init();
537} 534}
@@ -565,7 +562,6 @@ asmlinkage void __init start_kernel(void)
565 * Interrupts are still disabled. Do necessary setups, then 562 * Interrupts are still disabled. Do necessary setups, then
566 * enable them 563 * enable them
567 */ 564 */
568 lock_kernel();
569 tick_init(); 565 tick_init();
570 boot_cpu_init(); 566 boot_cpu_init();
571 page_address_init(); 567 page_address_init();
@@ -663,7 +659,6 @@ asmlinkage void __init start_kernel(void)
663#endif 659#endif
664 page_cgroup_init(); 660 page_cgroup_init();
665 enable_debug_pagealloc(); 661 enable_debug_pagealloc();
666 kmemtrace_init();
667 kmemleak_init(); 662 kmemleak_init();
668 debug_objects_mem_init(); 663 debug_objects_mem_init();
669 idr_init_cache(); 664 idr_init_cache();
@@ -725,38 +720,39 @@ int initcall_debug;
725core_param(initcall_debug, initcall_debug, bool, 0644); 720core_param(initcall_debug, initcall_debug, bool, 0644);
726 721
727static char msgbuf[64]; 722static char msgbuf[64];
728static struct boot_trace_call call;
729static struct boot_trace_ret ret;
730 723
731int do_one_initcall(initcall_t fn) 724static int __init_or_module do_one_initcall_debug(initcall_t fn)
732{ 725{
733 int count = preempt_count();
734 ktime_t calltime, delta, rettime; 726 ktime_t calltime, delta, rettime;
727 unsigned long long duration;
728 int ret;
735 729
736 if (initcall_debug) { 730 printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current));
737 call.caller = task_pid_nr(current); 731 calltime = ktime_get();
738 printk("calling %pF @ %i\n", fn, call.caller); 732 ret = fn();
739 calltime = ktime_get(); 733 rettime = ktime_get();
740 trace_boot_call(&call, fn); 734 delta = ktime_sub(rettime, calltime);
741 enable_boot_trace(); 735 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
742 } 736 printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn,
737 ret, duration);
743 738
744 ret.result = fn(); 739 return ret;
740}
745 741
746 if (initcall_debug) { 742int __init_or_module do_one_initcall(initcall_t fn)
747 disable_boot_trace(); 743{
748 rettime = ktime_get(); 744 int count = preempt_count();
749 delta = ktime_sub(rettime, calltime); 745 int ret;
750 ret.duration = (unsigned long long) ktime_to_ns(delta) >> 10; 746
751 trace_boot_ret(&ret, fn); 747 if (initcall_debug)
752 printk("initcall %pF returned %d after %Ld usecs\n", fn, 748 ret = do_one_initcall_debug(fn);
753 ret.result, ret.duration); 749 else
754 } 750 ret = fn();
755 751
756 msgbuf[0] = 0; 752 msgbuf[0] = 0;
757 753
758 if (ret.result && ret.result != -ENODEV && initcall_debug) 754 if (ret && ret != -ENODEV && initcall_debug)
759 sprintf(msgbuf, "error code %d ", ret.result); 755 sprintf(msgbuf, "error code %d ", ret);
760 756
761 if (preempt_count() != count) { 757 if (preempt_count() != count) {
762 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 758 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
@@ -770,7 +766,7 @@ int do_one_initcall(initcall_t fn)
770 printk("initcall %pF returned with %s\n", fn, msgbuf); 766 printk("initcall %pF returned with %s\n", fn, msgbuf);
771 } 767 }
772 768
773 return ret.result; 769 return ret;
774} 770}
775 771
776 772
@@ -796,7 +792,6 @@ static void __init do_initcalls(void)
796 */ 792 */
797static void __init do_basic_setup(void) 793static void __init do_basic_setup(void)
798{ 794{
799 init_workqueues();
800 cpuset_init_smp(); 795 cpuset_init_smp();
801 usermodehelper_init(); 796 usermodehelper_init();
802 init_tmpfs(); 797 init_tmpfs();
@@ -829,7 +824,6 @@ static noinline int init_post(void)
829 /* need to finish all async __init code before freeing the memory */ 824 /* need to finish all async __init code before freeing the memory */
830 async_synchronize_full(); 825 async_synchronize_full();
831 free_initmem(); 826 free_initmem();
832 unlock_kernel();
833 mark_rodata_ro(); 827 mark_rodata_ro();
834 system_state = SYSTEM_RUNNING; 828 system_state = SYSTEM_RUNNING;
835 numa_default_policy(); 829 numa_default_policy();
@@ -869,8 +863,6 @@ static int __init kernel_init(void * unused)
869 * Wait until kthreadd is all set-up. 863 * Wait until kthreadd is all set-up.
870 */ 864 */
871 wait_for_completion(&kthreadd_done); 865 wait_for_completion(&kthreadd_done);
872 lock_kernel();
873
874 /* 866 /*
875 * init can allocate pages on any node 867 * init can allocate pages on any node
876 */ 868 */
@@ -894,7 +886,6 @@ static int __init kernel_init(void * unused)
894 smp_prepare_cpus(setup_max_cpus); 886 smp_prepare_cpus(setup_max_cpus);
895 887
896 do_pre_smp_initcalls(); 888 do_pre_smp_initcalls();
897 start_boot_trace();
898 889
899 smp_init(); 890 smp_init();
900 sched_init_smp(); 891 sched_init_smp();