This function is called by init/main.c and earlier used to allocate space to pidmap. Now idr struct for init_pid_ns is initialised and ID 0 alocated using idr_alloc_cyclic. Also deleted NULL allocation for pidmap. Signed-off-by: Gargi Sharma <gs051095@xxxxxxxxx> --- include/linux/pid_namespace.h | 2 +- init/main.c | 2 +- kernel/pid.c | 12 ++++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index c2a989d..b089791 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -105,6 +105,6 @@ static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk); void pidhash_init(void); -void pidmap_init(void); +void pid_idr_init(void); #endif /* _LINUX_PID_NS_H */ diff --git a/init/main.c b/init/main.c index f866510..a14f01e 100644 --- a/init/main.c +++ b/init/main.c @@ -636,7 +636,7 @@ asmlinkage __visible void __init start_kernel(void) if (late_time_init) late_time_init(); calibrate_delay(); - pidmap_init(); + pid_idr_init(); anon_vma_init(); acpi_early_init(); #ifdef CONFIG_X86 diff --git a/kernel/pid.c b/kernel/pid.c index 3c74ca8..bd8024b 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -64,9 +64,6 @@ int pid_max_max = PID_MAX_LIMIT; */ struct pid_namespace init_pid_ns = { .kref = KREF_INIT(2), - .pidmap = { - [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } - }, .last_pid = 0, .nr_hashed = PIDNS_HASH_ADDING, .level = 0, @@ -459,7 +456,7 @@ void __init pidhash_init(void) INIT_HLIST_HEAD(&pid_hash[i]); } -void __init pidmap_init(void) +void __init pid_idr_init(void) { /* Verify no one has done anything silly: */ BUILD_BUG_ON(PID_MAX_LIMIT >= PIDNS_HASH_ADDING); @@ -471,10 +468,9 @@ void __init pidmap_init(void) PIDS_PER_CPU_MIN * num_possible_cpus()); pr_info("pid_max: default: %u minimum: %u\n", pid_max, pid_max_min); - init_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL); - /* Reserve PID 0. We never call free_pidmap(0) */ - set_bit(0, init_pid_ns.pidmap[0].page); - atomic_dec(&init_pid_ns.pidmap[0].nr_free); + idr_init(init_pid_ns.idr); + /* Reserve PID 0. */ + idr_alloc_cyclic(init_pid_ns.idr, &init_pid_ns, 0, 0, GFP_KERNEL); init_pid_ns.pid_cachep = KMEM_CACHE(pid, SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html