• Home
  • Raw
  • Download

Lines Matching refs:pid

46 struct pid init_struct_pid = INIT_STRUCT_PID;
144 static void set_last_pid(struct pid_namespace *pid_ns, int base, int pid) in set_last_pid() argument
150 last_write = cmpxchg(&pid_ns->last_pid, prev, pid); in set_last_pid()
151 } while ((prev != last_write) && (pid_before(base, last_write, pid))); in set_last_pid()
156 int i, offset, max_scan, pid, last = pid_ns->last_pid; in alloc_pidmap() local
159 pid = last + 1; in alloc_pidmap()
160 if (pid >= pid_max) in alloc_pidmap()
161 pid = RESERVED_PIDS; in alloc_pidmap()
162 offset = pid & BITS_PER_PAGE_MASK; in alloc_pidmap()
163 map = &pid_ns->pidmap[pid/BITS_PER_PAGE]; in alloc_pidmap()
191 set_last_pid(pid_ns, last, pid); in alloc_pidmap()
192 return pid; in alloc_pidmap()
197 pid = mk_pid(pid_ns, map, offset); in alloc_pidmap()
198 if (pid >= pid_max) in alloc_pidmap()
211 pid = mk_pid(pid_ns, map, offset); in alloc_pidmap()
237 void put_pid(struct pid *pid) in put_pid() argument
241 if (!pid) in put_pid()
244 ns = pid->numbers[pid->level].ns; in put_pid()
245 if ((atomic_read(&pid->count) == 1) || in put_pid()
246 atomic_dec_and_test(&pid->count)) { in put_pid()
247 kmem_cache_free(ns->pid_cachep, pid); in put_pid()
255 struct pid *pid = container_of(rhp, struct pid, rcu); in delayed_put_pid() local
256 put_pid(pid); in delayed_put_pid()
259 void free_pid(struct pid *pid) in free_pid() argument
266 for (i = 0; i <= pid->level; i++) { in free_pid()
267 struct upid *upid = pid->numbers + i; in free_pid()
291 for (i = 0; i <= pid->level; i++) in free_pid()
292 free_pidmap(pid->numbers + i); in free_pid()
294 call_rcu(&pid->rcu, delayed_put_pid); in free_pid()
297 struct pid *alloc_pid(struct pid_namespace *ns) in alloc_pid()
299 struct pid *pid; in alloc_pid() local
306 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); in alloc_pid()
307 if (!pid) in alloc_pid()
311 pid->level = ns->level; in alloc_pid()
319 pid->numbers[i].nr = nr; in alloc_pid()
320 pid->numbers[i].ns = tmp; in alloc_pid()
324 if (unlikely(is_child_reaper(pid))) { in alloc_pid()
332 atomic_set(&pid->count, 1); in alloc_pid()
334 INIT_HLIST_HEAD(&pid->tasks[type]); in alloc_pid()
336 upid = pid->numbers + ns->level; in alloc_pid()
340 for ( ; upid >= pid->numbers; --upid) { in alloc_pid()
347 return pid; in alloc_pid()
355 free_pidmap(pid->numbers + i); in alloc_pid()
357 kmem_cache_free(ns->pid_cachep, pid); in alloc_pid()
368 struct pid *find_pid_ns(int nr, struct pid_namespace *ns) in find_pid_ns()
375 return container_of(pnr, struct pid, in find_pid_ns()
382 struct pid *find_vpid(int nr) in find_vpid()
394 hlist_add_head_rcu(&link->node, &link->pid->tasks[type]); in attach_pid()
398 struct pid *new) in __change_pid()
401 struct pid *pid; in __change_pid() local
405 pid = link->pid; in __change_pid()
408 link->pid = new; in __change_pid()
411 if (!hlist_empty(&pid->tasks[tmp])) in __change_pid()
414 free_pid(pid); in __change_pid()
423 struct pid *pid) in change_pid() argument
425 __change_pid(task, type, pid); in change_pid()
433 new->pids[type].pid = old->pids[type].pid; in transfer_pid()
437 struct task_struct *pid_task(struct pid *pid, enum pid_type type) in pid_task() argument
440 if (pid) { in pid_task()
442 first = rcu_dereference_check(hlist_first_rcu(&pid->tasks[type]), in pid_task()
466 struct pid *get_task_pid(struct task_struct *task, enum pid_type type) in get_task_pid()
468 struct pid *pid; in get_task_pid() local
472 pid = get_pid(rcu_dereference(task->pids[type].pid)); in get_task_pid()
474 return pid; in get_task_pid()
478 struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) in get_pid_task() argument
482 result = pid_task(pid, type); in get_pid_task()
490 struct pid *find_get_pid(pid_t nr) in find_get_pid()
492 struct pid *pid; in find_get_pid() local
495 pid = get_pid(find_vpid(nr)); in find_get_pid()
498 return pid; in find_get_pid()
502 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns) in pid_nr_ns() argument
507 if (pid && ns->level <= pid->level) { in pid_nr_ns()
508 upid = &pid->numbers[ns->level]; in pid_nr_ns()
516 pid_t pid_vnr(struct pid *pid) in pid_vnr() argument
518 return pid_nr_ns(pid, task_active_pid_ns(current)); in pid_vnr()
536 nr = pid_nr_ns(rcu_dereference(task->pids[type].pid), ns); in __task_pid_nr_ns()
555 struct pid *find_ge_pid(int nr, struct pid_namespace *ns) in find_ge_pid()
557 struct pid *pid; in find_ge_pid() local
560 pid = find_pid_ns(nr, ns); in find_ge_pid()
561 if (pid) in find_ge_pid()
566 return pid; in find_ge_pid()
605 init_pid_ns.pid_cachep = KMEM_CACHE(pid, in pidmap_init()