diff options
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 2e17c9c92cbe..e9fd8c132d26 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -367,7 +367,9 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type) | |||
367 | struct task_struct *result = NULL; | 367 | struct task_struct *result = NULL; |
368 | if (pid) { | 368 | if (pid) { |
369 | struct hlist_node *first; | 369 | struct hlist_node *first; |
370 | first = rcu_dereference(pid->tasks[type].first); | 370 | first = rcu_dereference_check(pid->tasks[type].first, |
371 | rcu_read_lock_held() || | ||
372 | lockdep_tasklist_lock_is_held()); | ||
371 | if (first) | 373 | if (first) |
372 | result = hlist_entry(first, struct task_struct, pids[(type)].node); | 374 | result = hlist_entry(first, struct task_struct, pids[(type)].node); |
373 | } | 375 | } |
@@ -376,7 +378,7 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type) | |||
376 | EXPORT_SYMBOL(pid_task); | 378 | EXPORT_SYMBOL(pid_task); |
377 | 379 | ||
378 | /* | 380 | /* |
379 | * Must be called under rcu_read_lock() or with tasklist_lock read-held. | 381 | * Must be called under rcu_read_lock(). |
380 | */ | 382 | */ |
381 | struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) | 383 | struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) |
382 | { | 384 | { |
@@ -511,6 +513,13 @@ void __init pidhash_init(void) | |||
511 | 513 | ||
512 | void __init pidmap_init(void) | 514 | void __init pidmap_init(void) |
513 | { | 515 | { |
516 | /* bump default and minimum pid_max based on number of cpus */ | ||
517 | pid_max = min(pid_max_max, max_t(int, pid_max, | ||
518 | PIDS_PER_CPU_DEFAULT * num_possible_cpus())); | ||
519 | pid_max_min = max_t(int, pid_max_min, | ||
520 | PIDS_PER_CPU_MIN * num_possible_cpus()); | ||
521 | pr_info("pid_max: default: %u minimum: %u\n", pid_max, pid_max_min); | ||
522 | |||
514 | init_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL); | 523 | init_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL); |
515 | /* Reserve PID 0. We never call free_pidmap(0) */ | 524 | /* Reserve PID 0. We never call free_pidmap(0) */ |
516 | set_bit(0, init_pid_ns.pidmap[0].page); | 525 | set_bit(0, init_pid_ns.pidmap[0].page); |