Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched.h: move pid helpers to pid.h

This is needed for killing the sched.h dependency on rcupdate.h, and
pid.h is a better place for this code anyways.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+134 -124
+1
arch/x86/um/sysrq_64.c
··· 6 6 7 7 #include <linux/kernel.h> 8 8 #include <linux/module.h> 9 + #include <linux/pid.h> 9 10 #include <linux/sched.h> 10 11 #include <linux/sched/debug.h> 11 12 #include <linux/utsname.h>
+1
drivers/gpu/drm/lima/lima_ctx.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR MIT 2 2 /* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */ 3 3 4 + #include <linux/pid.h> 4 5 #include <linux/slab.h> 5 6 6 7 #include "lima_device.h"
+1
drivers/irqchip/irq-gic-v4.c
··· 8 8 #include <linux/irq.h> 9 9 #include <linux/irqdomain.h> 10 10 #include <linux/msi.h> 11 + #include <linux/pid.h> 11 12 #include <linux/sched.h> 12 13 13 14 #include <linux/irqchip/arm-gic-v4.h>
+125
include/linux/pid.h
··· 4 4 5 5 #include <linux/pid_types.h> 6 6 #include <linux/rculist.h> 7 + #include <linux/rcupdate.h> 7 8 #include <linux/refcount.h> 9 + #include <linux/sched.h> 8 10 #include <linux/wait.h> 9 11 10 12 /* ··· 206 204 } \ 207 205 task = tg___; \ 208 206 } while_each_pid_task(pid, type, task) 207 + 208 + static inline struct pid *task_pid(struct task_struct *task) 209 + { 210 + return task->thread_pid; 211 + } 212 + 213 + /* 214 + * the helpers to get the task's different pids as they are seen 215 + * from various namespaces 216 + * 217 + * task_xid_nr() : global id, i.e. the id seen from the init namespace; 218 + * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of 219 + * current. 220 + * task_xid_nr_ns() : id seen from the ns specified; 221 + * 222 + * see also pid_nr() etc in include/linux/pid.h 223 + */ 224 + pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns); 225 + 226 + static inline pid_t task_pid_nr(struct task_struct *tsk) 227 + { 228 + return tsk->pid; 229 + } 230 + 231 + static inline pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 232 + { 233 + return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns); 234 + } 235 + 236 + static inline pid_t task_pid_vnr(struct task_struct *tsk) 237 + { 238 + return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL); 239 + } 240 + 241 + 242 + static inline pid_t task_tgid_nr(struct task_struct *tsk) 243 + { 244 + return tsk->tgid; 245 + } 246 + 247 + /** 248 + * pid_alive - check that a task structure is not stale 249 + * @p: Task structure to be checked. 250 + * 251 + * Test if a process is not yet dead (at most zombie state) 252 + * If pid_alive fails, then pointers within the task structure 253 + * can be stale and must not be dereferenced. 254 + * 255 + * Return: 1 if the process is alive. 0 otherwise. 256 + */ 257 + static inline int pid_alive(const struct task_struct *p) 258 + { 259 + return p->thread_pid != NULL; 260 + } 261 + 262 + static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 263 + { 264 + return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); 265 + } 266 + 267 + static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 268 + { 269 + return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL); 270 + } 271 + 272 + 273 + static inline pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 274 + { 275 + return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns); 276 + } 277 + 278 + static inline pid_t task_session_vnr(struct task_struct *tsk) 279 + { 280 + return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); 281 + } 282 + 283 + static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 284 + { 285 + return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns); 286 + } 287 + 288 + static inline pid_t task_tgid_vnr(struct task_struct *tsk) 289 + { 290 + return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL); 291 + } 292 + 293 + static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) 294 + { 295 + pid_t pid = 0; 296 + 297 + rcu_read_lock(); 298 + if (pid_alive(tsk)) 299 + pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns); 300 + rcu_read_unlock(); 301 + 302 + return pid; 303 + } 304 + 305 + static inline pid_t task_ppid_nr(const struct task_struct *tsk) 306 + { 307 + return task_ppid_nr_ns(tsk, &init_pid_ns); 308 + } 309 + 310 + /* Obsolete, do not use: */ 311 + static inline pid_t task_pgrp_nr(struct task_struct *tsk) 312 + { 313 + return task_pgrp_nr_ns(tsk, &init_pid_ns); 314 + } 315 + 316 + /** 317 + * is_global_init - check if a task structure is init. Since init 318 + * is free to have sub-threads we need to check tgid. 319 + * @tsk: Task structure to be checked. 320 + * 321 + * Check if a task structure is the first user space task the kernel created. 322 + * 323 + * Return: 1 if the task structure is init. 0 otherwise. 324 + */ 325 + static inline int is_global_init(struct task_struct *tsk) 326 + { 327 + return task_tgid_nr(tsk) == 1; 328 + } 329 + 209 330 #endif /* _LINUX_PID_H */
-122
include/linux/sched.h
··· 1561 1561 */ 1562 1562 }; 1563 1563 1564 - static inline struct pid *task_pid(struct task_struct *task) 1565 - { 1566 - return task->thread_pid; 1567 - } 1568 - 1569 - /* 1570 - * the helpers to get the task's different pids as they are seen 1571 - * from various namespaces 1572 - * 1573 - * task_xid_nr() : global id, i.e. the id seen from the init namespace; 1574 - * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of 1575 - * current. 1576 - * task_xid_nr_ns() : id seen from the ns specified; 1577 - * 1578 - * see also pid_nr() etc in include/linux/pid.h 1579 - */ 1580 - pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns); 1581 - 1582 - static inline pid_t task_pid_nr(struct task_struct *tsk) 1583 - { 1584 - return tsk->pid; 1585 - } 1586 - 1587 - static inline pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1588 - { 1589 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns); 1590 - } 1591 - 1592 - static inline pid_t task_pid_vnr(struct task_struct *tsk) 1593 - { 1594 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL); 1595 - } 1596 - 1597 - 1598 - static inline pid_t task_tgid_nr(struct task_struct *tsk) 1599 - { 1600 - return tsk->tgid; 1601 - } 1602 - 1603 - /** 1604 - * pid_alive - check that a task structure is not stale 1605 - * @p: Task structure to be checked. 1606 - * 1607 - * Test if a process is not yet dead (at most zombie state) 1608 - * If pid_alive fails, then pointers within the task structure 1609 - * can be stale and must not be dereferenced. 1610 - * 1611 - * Return: 1 if the process is alive. 0 otherwise. 1612 - */ 1613 - static inline int pid_alive(const struct task_struct *p) 1614 - { 1615 - return p->thread_pid != NULL; 1616 - } 1617 - 1618 - static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1619 - { 1620 - return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); 1621 - } 1622 - 1623 - static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 1624 - { 1625 - return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL); 1626 - } 1627 - 1628 - 1629 - static inline pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1630 - { 1631 - return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns); 1632 - } 1633 - 1634 - static inline pid_t task_session_vnr(struct task_struct *tsk) 1635 - { 1636 - return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); 1637 - } 1638 - 1639 - static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1640 - { 1641 - return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns); 1642 - } 1643 - 1644 - static inline pid_t task_tgid_vnr(struct task_struct *tsk) 1645 - { 1646 - return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL); 1647 - } 1648 - 1649 - static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) 1650 - { 1651 - pid_t pid = 0; 1652 - 1653 - rcu_read_lock(); 1654 - if (pid_alive(tsk)) 1655 - pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns); 1656 - rcu_read_unlock(); 1657 - 1658 - return pid; 1659 - } 1660 - 1661 - static inline pid_t task_ppid_nr(const struct task_struct *tsk) 1662 - { 1663 - return task_ppid_nr_ns(tsk, &init_pid_ns); 1664 - } 1665 - 1666 - /* Obsolete, do not use: */ 1667 - static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1668 - { 1669 - return task_pgrp_nr_ns(tsk, &init_pid_ns); 1670 - } 1671 - 1672 1564 #define TASK_REPORT_IDLE (TASK_REPORT + 1) 1673 1565 #define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1) 1674 1566 ··· 1602 1710 static inline char task_state_to_char(struct task_struct *tsk) 1603 1711 { 1604 1712 return task_index_to_char(task_state_index(tsk)); 1605 - } 1606 - 1607 - /** 1608 - * is_global_init - check if a task structure is init. Since init 1609 - * is free to have sub-threads we need to check tgid. 1610 - * @tsk: Task structure to be checked. 1611 - * 1612 - * Check if a task structure is the first user space task the kernel created. 1613 - * 1614 - * Return: 1 if the task structure is init. 0 otherwise. 1615 - */ 1616 - static inline int is_global_init(struct task_struct *tsk) 1617 - { 1618 - return task_tgid_nr(tsk) == 1; 1619 1713 } 1620 1714 1621 1715 extern struct pid *cad_pid;
+1
include/linux/sched/signal.h
··· 9 9 #include <linux/sched/task.h> 10 10 #include <linux/cred.h> 11 11 #include <linux/refcount.h> 12 + #include <linux/pid.h> 12 13 #include <linux/posix-timers.h> 13 14 #include <linux/mm_types.h> 14 15 #include <asm/ptrace.h>
+1
ipc/util.h
··· 14 14 #include <linux/unistd.h> 15 15 #include <linux/err.h> 16 16 #include <linux/ipc_namespace.h> 17 + #include <linux/pid.h> 17 18 18 19 /* 19 20 * The IPC ID contains 2 separate numbers - index and sequence number.
+3 -2
kernel/async.c
··· 46 46 47 47 #include <linux/async.h> 48 48 #include <linux/atomic.h> 49 - #include <linux/ktime.h> 50 49 #include <linux/export.h> 51 - #include <linux/wait.h> 50 + #include <linux/ktime.h> 51 + #include <linux/pid.h> 52 52 #include <linux/sched.h> 53 53 #include <linux/slab.h> 54 + #include <linux/wait.h> 54 55 #include <linux/workqueue.h> 55 56 56 57 #include "workqueue_internal.h"
+1
kernel/locking/spinlock_debug.c
··· 12 12 #include <linux/debug_locks.h> 13 13 #include <linux/delay.h> 14 14 #include <linux/export.h> 15 + #include <linux/pid.h> 15 16 16 17 void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, 17 18 struct lock_class_key *key, short inner)