summaryrefslogtreecommitdiff
path: root/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/init/main.c b/init/main.c
index 99ce94930b09..a87d4ca5c36c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -52,12 +52,14 @@
#include <linux/unwind.h>
#include <linux/buffer_head.h>
#include <linux/debug_locks.h>
+#include <linux/debugobjects.h>
#include <linux/lockdep.h>
#include <linux/pid_namespace.h>
#include <linux/device.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/signal.h>
+#include <linux/idr.h>
#include <asm/io.h>
#include <asm/bugs.h>
@@ -359,10 +361,31 @@ static void __init smp_init(void)
#endif
static inline void setup_per_cpu_areas(void) { }
+static inline void setup_nr_cpu_ids(void) { }
static inline void smp_prepare_cpus(unsigned int maxcpus) { }
#else
+#if NR_CPUS > BITS_PER_LONG
+cpumask_t cpu_mask_all __read_mostly = CPU_MASK_ALL;
+EXPORT_SYMBOL(cpu_mask_all);
+#endif
+
+/* Setup number of possible processor ids */
+int nr_cpu_ids __read_mostly = NR_CPUS;
+EXPORT_SYMBOL(nr_cpu_ids);
+
+/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
+static void __init setup_nr_cpu_ids(void)
+{
+ int cpu, highest_cpu = 0;
+
+ for_each_possible_cpu(cpu)
+ highest_cpu = cpu;
+
+ nr_cpu_ids = highest_cpu + 1;
+}
+
#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
@@ -437,7 +460,7 @@ static void noinline __init_refok rest_init(void)
kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
- kthreadd_task = find_task_by_pid(pid);
+ kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
unlock_kernel();
/*
@@ -500,7 +523,11 @@ static void __init boot_cpu_init(void)
cpu_set(cpu, cpu_possible_map);
}
-void __init __attribute__((weak)) smp_setup_processor_id(void)
+void __init __weak smp_setup_processor_id(void)
+{
+}
+
+void __init __weak thread_info_cache_init(void)
{
}
@@ -517,6 +544,7 @@ asmlinkage void __init start_kernel(void)
*/
unwind_init();
lockdep_init();
+ debug_objects_early_init();
cgroup_init_early();
local_irq_disable();
@@ -534,9 +562,11 @@ asmlinkage void __init start_kernel(void)
printk(KERN_NOTICE);
printk(linux_banner);
setup_arch(&command_line);
+ mm_init_owner(&init_mm, &init_task);
setup_command_line(command_line);
unwind_setup();
setup_per_cpu_areas();
+ setup_nr_cpu_ids();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
/*
@@ -610,6 +640,8 @@ asmlinkage void __init start_kernel(void)
enable_debug_pagealloc();
cpu_hotplug_init();
kmem_cache_init();
+ debug_objects_mem_init();
+ idr_init_cache();
setup_per_cpu_pageset();
numa_policy_init();
if (late_time_init)
@@ -623,6 +655,7 @@ asmlinkage void __init start_kernel(void)
if (efi_enabled)
efi_enter_virtual_mode();
#endif
+ thread_info_cache_init();
fork_init(num_physpages);
proc_caches_init();
buffer_init();
@@ -673,10 +706,8 @@ static void __init do_initcalls(void)
int result;
if (initcall_debug) {
- printk("Calling initcall 0x%p", *call);
- print_fn_descriptor_symbol(": %s()",
+ print_fn_descriptor_symbol("calling %s()\n",
(unsigned long) *call);
- printk("\n");
t0 = ktime_get();
}
@@ -686,15 +717,10 @@ static void __init do_initcalls(void)
t1 = ktime_get();
delta = ktime_sub(t1, t0);
- printk("initcall 0x%p", *call);
- print_fn_descriptor_symbol(": %s()",
+ print_fn_descriptor_symbol("initcall %s()",
(unsigned long) *call);
- printk(" returned %d.\n", result);
-
- printk("initcall 0x%p ran for %Ld msecs: ",
- *call, (unsigned long long)delta.tv64 >> 20);
- print_fn_descriptor_symbol("%s()\n",
- (unsigned long) *call);
+ printk(" returned %d after %Ld msecs\n", result,
+ (unsigned long long) delta.tv64 >> 20);
}
if (result && result != -ENODEV && initcall_debug) {
@@ -710,10 +736,9 @@ static void __init do_initcalls(void)
local_irq_enable();
}
if (msg) {
- printk(KERN_WARNING "initcall at 0x%p", *call);
- print_fn_descriptor_symbol(": %s()",
+ print_fn_descriptor_symbol(KERN_WARNING "initcall %s()",
(unsigned long) *call);
- printk(": returned with %s\n", msg);
+ printk(" returned with %s\n", msg);
}
}
@@ -780,6 +805,8 @@ static int noinline init_post(void)
(void) sys_dup(0);
(void) sys_dup(0);
+ current->signal->flags |= SIGNAL_UNKILLABLE;
+
if (ramdisk_execute_command) {
run_init_process(ramdisk_execute_command);
printk(KERN_WARNING "Failed to execute %s\n",
@@ -811,7 +838,7 @@ static int __init kernel_init(void * unused)
/*
* init can run on any cpu.
*/
- set_cpus_allowed(current, CPU_MASK_ALL);
+ set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR);
/*
* Tell the world that we're going to be the grim
* reaper of innocent orphaned children.