History

Merge tag 'header_cleanup-2024-01-10' of https://evilpiepirate.org/git/bcachefs

Pull header cleanups from Kent Overstreet: "The goal is to get sched.h down to a type only header, so the main thing happening in this patchset is splitting out various _types.h headers and dependency fixups, as well as moving some things out of sched.h to better locations. This is prep work for the memory allocation profiling patchset which adds new sched.h interdepencencies" * tag 'header_cleanup-2024-01-10' of https://evilpiepirate.org/git/bcachefs: (51 commits) Kill sched.h dependency on rcupdate.h kill unnecessary thread_info.h include Kill unnecessary kernel.h include preempt.h: Kill dependency on list.h rseq: Split out rseq.h from sched.h LoongArch: signal.c: add header file to fix build error restart_block: Trim includes lockdep: move held_lock to lockdep_types.h sem: Split out sem_types.h uidgid: Split out uidgid_types.h seccomp: Split out seccomp_types.h refcount: Split out refcount_types.h uapi/linux/resource.h: fix include x86/signal: kill dependency on time.h syscall_user_dispatch.h: split out *_types.h mm_types_task.h: Trim dependencies Split out irqflags_types.h ipc: Kill bogus dependency on spinlock.h shm: Slim down dependencies workqueue: Split out workqueue_types.h ...

Linus Torvalds committed 2 years ago

Commit 78273df2 parents 999a36b 1e2f2d3119 files · +1062 −775Browse files

Unified · Split

119 files
  1. arch/arm64/include/asm/spectre.h +2 −2
  2. arch/arm64/kernel/ptrace.c +1 −0
  3. arch/loongarch/kernel/signal.c +1 −0
  4. arch/m68k/include/asm/processor.h +1 −0
  5. arch/microblaze/include/asm/pgtable.h +1 −0
  6. arch/parisc/mm/init.c +1 −0
  7. arch/powerpc/kernel/interrupt.c +1 −0
  8. arch/powerpc/kvm/book3s_64_vio.c +1 −0
  9. arch/s390/kernel/signal.c +1 −0
  10. arch/x86/include/asm/current.h +1 −0
  11. arch/x86/include/asm/debugreg.h +1 −0
  12. arch/x86/include/asm/fpu/types.h +2 −0
  13. arch/x86/include/asm/paravirt.h +4 −0
  14. arch/x86/include/asm/paravirt_types.h +1 −0
  15. arch/x86/include/asm/percpu.h +1 −1
  16. arch/x86/include/asm/preempt.h +0 −1
  17. arch/x86/include/uapi/asm/signal.h +0 −1
  18. arch/x86/kernel/fpu/bugs.c +1 −0
  19. arch/x86/kernel/signal.c +1 −0
  20. arch/x86/lib/cache-smp.c +1 −0
  21. arch/x86/um/sysrq_64.c +1 −0
  22. drivers/base/power/runtime.c +1 −0
  23. drivers/gpu/drm/i915/i915_memcpy.c +2 −0
  24. drivers/gpu/drm/lima/lima_ctx.c +1 −0
  25. drivers/irqchip/irq-gic-v4.c +1 −0
  26. drivers/media/test-drivers/vidtv/vidtv_pes.c +1 −0
  27. drivers/target/target_core_xcopy.c +1 −0
  28. fs/exec.c +1 −0
  29. include/linux/audit.h +1 −0
  30. include/linux/dma-fence.h +1 −0
  31. include/linux/hrtimer.h +3 −43
  32. include/linux/hrtimer_types.h +50 −0
  33. include/linux/ipc.h +1 −1
  34. include/linux/irqflags.h +1 −13
  35. include/linux/irqflags_types.h +22 −0
  36. include/linux/kmsan_types.h +2 −0
  37. include/linux/ktime.h +3 −5
  38. include/linux/lockdep.h +0 −57
  39. include/linux/lockdep_types.h +57 −0
  40. include/linux/mm_types_task.h +2 −3
  41. include/linux/mutex.h +1 −51
  42. include/linux/mutex_types.h +71 −0
  43. include/linux/nodemask.h +1 −1
  44. include/linux/nodemask_types.h +10 −0
  45. include/linux/nsproxy.h +1 −0
  46. include/linux/numa.h +6 −13
  47. include/linux/pid.h +127 −13
  48. include/linux/pid_types.h +16 −0
  49. include/linux/plist.h +1 −11
  50. include/linux/plist_types.h +17 −0
  51. include/linux/posix-timers.h +3 −66
  52. include/linux/posix-timers_types.h +80 −0
  53. include/linux/prandom.h +0 −1
  54. include/linux/preempt.h +4 −2
  55. include/linux/rcupdate_wait.h +10 −0
  56. include/linux/refcount.h +1 −12
  57. include/linux/refcount_types.h +19 −0
  58. include/linux/restart_block.h +1 −1
  59. include/linux/resume_user_mode.h +1 −0
  60. include/linux/rhashtable-types.h +1 −1
  61. include/linux/rseq.h +131 −0
  62. include/linux/rslib.h +0 −1
  63. include/linux/sched.h +25 −300
  64. include/linux/sched/signal.h +1 −0
  65. include/linux/sched/task.h +2 −0
  66. include/linux/sched/task_stack.h +1 −0
  67. include/linux/seccomp.h +3 −21
  68. include/linux/seccomp_types.h +35 −0
  69. include/linux/sem.h +1 −9
  70. include/linux/sem_types.h +13 −0
  71. include/linux/seqlock.h +2 −77
  72. include/linux/seqlock_types.h +93 −0
  73. include/linux/shm.h +2 −2
  74. include/linux/signal.h +1 −0
  75. include/linux/signal_types.h +1 −1
  76. include/linux/spinlock.h +31 −0
  77. include/linux/syscall_user_dispatch.h +1 −8
  78. include/linux/syscall_user_dispatch_types.h +22 −0
  79. include/linux/time_namespace.h +3 −0
  80. include/linux/timekeeping.h +1 −0
  81. include/linux/timer.h +1 −15
  82. include/linux/timer_types.h +23 −0
  83. include/linux/timerqueue.h +1 −12
  84. include/linux/timerqueue_types.h +17 −0
  85. include/linux/torture.h +1 −0
  86. include/linux/types.h +3 −0
  87. include/linux/uidgid.h +1 −10
  88. include/linux/uidgid_types.h +15 −0
  89. include/linux/wait.h +0 −1
  90. include/linux/workqueue.h +1 −15
  91. include/linux/workqueue_types.h +25 −0
  92. include/uapi/linux/resource.h +1 −1
  93. init/init_task.c +1 −0
  94. ipc/shm.c +1 −0
  95. ipc/util.h +1 −0
  96. kernel/Makefile +1 −0
  97. kernel/async.c +3 −2
  98. kernel/bpf/hashtab.c +1 −0
  99. kernel/exit.c +3 −1
  100. kernel/fork.c +2 −0
  101. kernel/futex/core.c +1 −0
  102. kernel/futex/requeue.c +1 −0
  103. kernel/futex/waitwake.c +1 −0
  104. kernel/locking/spinlock_debug.c +1 −0
  105. kernel/numa.c +26 −0
  106. kernel/pid_namespace.c +1 −0
  107. kernel/sched/core.c +1 −0
  108. lib/test_rhashtable.c +1 −0
  109. mm/filemap.c +1 −0
  110. mm/khugepaged.c +1 −0
  111. mm/shmem.c +1 −0
  112. mm/swapfile.c +1 −0
  113. net/ipv4/fib_trie.c +1 −0
  114. net/netfilter/ipset/ip_set_bitmap_gen.h +2 −0
  115. net/netfilter/ipset/ip_set_hash_gen.h +1 −0
  116. net/netfilter/ipvs/ip_vs_conn.c +1 −0
  117. net/netfilter/ipvs/ip_vs_est.c +1 −0
  118. security/selinux/hooks.c +1 −0
  119. security/smack/smack_lsm.c +1 −0
arch/arm64/include/asm/spectre.h+2−2
@@ -13,8 +13,8 @@ · 12 unmodified lines
1313 #define __BP_HARDEN_HYP_VECS_SZ ((BP_HARDEN_EL2_SLOTS - 1) * SZ_2K)
1414
1515 #ifndef __ASSEMBLY__
16−
17−#include <linux/percpu.h>
16+#include <linux/smp.h>
17+#include <asm/percpu.h>
1818
1919 #include <asm/cpufeature.h>
2020 #include <asm/virt.h>
arch/arm64/kernel/ptrace.c+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/hw_breakpoint.h>
2929 #include <linux/regset.h>
3030 #include <linux/elf.h>
31+#include <linux/rseq.h>
3132
3233 #include <asm/compat.h>
3334 #include <asm/cpufeature.h>
arch/loongarch/kernel/signal.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/context_tracking.h>
1616 #include <linux/entry-common.h>
1717 #include <linux/irqflags.h>
18+#include <linux/rseq.h>
1819 #include <linux/sched.h>
1920 #include <linux/mm.h>
2021 #include <linux/personality.h>
arch/m68k/include/asm/processor.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef __ASM_M68K_PROCESSOR_H
99 #define __ASM_M68K_PROCESSOR_H
1010
11+#include <linux/preempt.h>
1112 #include <linux/thread_info.h>
1213 #include <asm/fpu.h>
1314 #include <asm/ptrace.h>
arch/microblaze/include/asm/pgtable.h+1−0
@@ -336,6 +336,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) · 335 unmodified lines
336336 }
337337
338338 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
339+struct vm_area_struct;
339340 static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
340341 unsigned long address, pte_t *ptep)
341342 {
arch/parisc/mm/init.c+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <asm/msgbuf.h>
3434 #include <asm/sparsemem.h>
3535 #include <asm/asm-offsets.h>
36+#include <asm/shmbuf.h>
3637
3738 extern int data_start;
3839 extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
arch/powerpc/kernel/interrupt.c+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #include <linux/context_tracking.h>
44 #include <linux/err.h>
55 #include <linux/compat.h>
6+#include <linux/rseq.h>
67 #include <linux/sched/debug.h> /* for show_regs */
78
89 #include <asm/kup.h>
arch/powerpc/kvm/book3s_64_vio.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/iommu.h>
2121 #include <linux/file.h>
2222 #include <linux/mm.h>
23+#include <linux/rcupdate_wait.h>
2324
2425 #include <asm/kvm_ppc.h>
2526 #include <asm/kvm_book3s.h>
arch/s390/kernel/signal.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <linux/sched.h>
1414 #include <linux/sched/task_stack.h>
15+#include <linux/rseq.h>
1516 #include <linux/mm.h>
1617 #include <linux/smp.h>
1718 #include <linux/kernel.h>
arch/x86/include/asm/current.h+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #ifndef _ASM_X86_CURRENT_H
33 #define _ASM_X86_CURRENT_H
44
5+#include <linux/build_bug.h>
56 #include <linux/compiler.h>
67
78 #ifndef __ASSEMBLY__
arch/x86/include/asm/debugreg.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/bug.h>
66 #include <linux/percpu.h>
77 #include <uapi/asm/debugreg.h>
8+#include <asm/cpufeature.h>
89
910 DECLARE_PER_CPU(unsigned long, cpu_dr7);
1011
arch/x86/include/asm/fpu/types.h+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 #ifndef _ASM_X86_FPU_H
66 #define _ASM_X86_FPU_H
77
8+#include <asm/page_types.h>
9+
810 /*
911 * The legacy x87 FPU state format, as saved by FSAVE and
1012 * restored by the FRSTOR instructions:
arch/x86/include/asm/paravirt.h+4−0
@@ -6,6 +6,10 @@ · 5 unmodified lines
66
77 #include <asm/paravirt_types.h>
88
9+#ifndef __ASSEMBLY__
10+struct mm_struct;
11+#endif
12+
913 #ifdef CONFIG_PARAVIRT
1014 #include <asm/pgtable_types.h>
1115 #include <asm/asm.h>
arch/x86/include/asm/paravirt_types.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #ifdef CONFIG_PARAVIRT
66
77 #ifndef __ASSEMBLY__
8+#include <linux/types.h>
89
910 #include <asm/desc_defs.h>
1011 #include <asm/pgtable_types.h>
arch/x86/include/asm/percpu.h+1−1
@@ -24,8 +24,8 @@ · 23 unmodified lines
2424
2525 #else /* ...!ASSEMBLY */
2626
27−#include <linux/kernel.h>
2827 #include <linux/stringify.h>
28+#include <asm/asm.h>
2929
3030 #ifdef CONFIG_SMP
3131 #define __percpu_prefix "%%"__stringify(__percpu_seg)":"
arch/x86/include/asm/preempt.h+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66 #include <asm/percpu.h>
77 #include <asm/current.h>
88
9−#include <linux/thread_info.h>
109 #include <linux/static_call_types.h>
1110
1211 /* We use the MSB mostly because its available */
arch/x86/include/uapi/asm/signal.h+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #ifndef __ASSEMBLY__
66 #include <linux/types.h>
7−#include <linux/time.h>
87 #include <linux/compiler.h>
98
109 /* Avoid too many header ordering problems. */
arch/x86/kernel/fpu/bugs.c+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /*
33 * x86 FPU bug checks:
44 */
5+#include <asm/cpufeature.h>
56 #include <asm/fpu/api.h>
67
78 /*
arch/x86/kernel/signal.c+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/context_tracking.h>
2828 #include <linux/entry-common.h>
2929 #include <linux/syscalls.h>
30+#include <linux/rseq.h>
3031
3132 #include <asm/processor.h>
3233 #include <asm/ucontext.h>
arch/x86/lib/cache-smp.c+1−0
@@ -1,4 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2+#include <asm/paravirt.h>
23 #include <linux/smp.h>
34 #include <linux/export.h>
45
arch/x86/um/sysrq_64.c+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66
77 #include <linux/kernel.h>
88 #include <linux/module.h>
9+#include <linux/pid.h>
910 #include <linux/sched.h>
1011 #include <linux/sched/debug.h>
1112 #include <linux/utsname.h>
drivers/base/power/runtime.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/export.h>
1212 #include <linux/pm_runtime.h>
1313 #include <linux/pm_wakeirq.h>
14+#include <linux/rculist.h>
1415 #include <trace/events/rpm.h>
1516
1617 #include "../base.h"
drivers/gpu/drm/i915/i915_memcpy.c+2−0
@@ -23,6 +23,8 @@ · 22 unmodified lines
2323 */
2424
2525 #include <linux/kernel.h>
26+#include <linux/string.h>
27+#include <linux/cpufeature.h>
2628 #include <asm/fpu/api.h>
2729
2830 #include "i915_memcpy.h"
drivers/gpu/drm/lima/lima_ctx.c+1−0
@@ -1,6 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 OR MIT
22 /* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */
33
4+#include <linux/pid.h>
45 #include <linux/slab.h>
56
67 #include "lima_device.h"
drivers/irqchip/irq-gic-v4.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/irq.h>
99 #include <linux/irqdomain.h>
1010 #include <linux/msi.h>
11+#include <linux/pid.h>
1112 #include <linux/sched.h>
1213
1314 #include <linux/irqchip/arm-gic-v4.h>
drivers/media/test-drivers/vidtv/vidtv_pes.c+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__
1515
1616 #include <linux/types.h>
17+#include <linux/math64.h>
1718 #include <linux/printk.h>
1819 #include <linux/ratelimit.h>
1920
drivers/target/target_core_xcopy.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/slab.h>
1616 #include <linux/spinlock.h>
1717 #include <linux/list.h>
18+#include <linux/rculist.h>
1819 #include <linux/configfs.h>
1920 #include <linux/ratelimit.h>
2021 #include <scsi/scsi_proto.h>
fs/exec.c+1−0
@@ -66,6 +66,7 @@ · 65 unmodified lines
6666 #include <linux/coredump.h>
6767 #include <linux/time_namespace.h>
6868 #include <linux/user_events.h>
69+#include <linux/rseq.h>
6970
7071 #include <linux/uaccess.h>
7172 #include <asm/mmu_context.h>
include/linux/audit.h+1−0
@@ -36,6 +36,7 @@ struct mqstat; · 35 unmodified lines
3636 struct audit_watch;
3737 struct audit_tree;
3838 struct sk_buff;
39+struct kern_ipc_perm;
3940
4041 struct audit_krule {
4142 u32 pflags;
include/linux/dma-fence.h+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/sched.h>
2222 #include <linux/printk.h>
2323 #include <linux/rcupdate.h>
24+#include <linux/timekeeping.h>
2425
2526 struct dma_fence;
2627 struct dma_fence_ops;
include/linux/hrtimer.h+3−43
@@ -13,13 +13,13 @@ · 12 unmodified lines
1313 #define _LINUX_HRTIMER_H
1414
1515 #include <linux/hrtimer_defs.h>
16−#include <linux/rbtree.h>
16+#include <linux/hrtimer_types.h>
1717 #include <linux/init.h>
1818 #include <linux/list.h>
19−#include <linux/percpu.h>
19+#include <linux/percpu-defs.h>
20+#include <linux/rbtree.h>
2021 #include <linux/seqlock.h>
2122 #include <linux/timer.h>
22−#include <linux/timerqueue.h>
2323
2424 struct hrtimer_clock_base;
2525 struct hrtimer_cpu_base;
@@ -59,14 +59,6 @@ enum hrtimer_mode { · 33 unmodified lines
5959 HRTIMER_MODE_REL_PINNED_HARD = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_HARD,
6060 };
6161
62−/*
63− * Return values for the callback function
64− */
65−enum hrtimer_restart {
66− HRTIMER_NORESTART, /* Timer is not restarted */
67− HRTIMER_RESTART, /* Timer must be restarted */
68−};
69−
7062 /*
7163 * Values to track state of the timer
7264 *
@@ -94,38 +86,6 @@ enum hrtimer_restart { · 21 unmodified lines
9486 #define HRTIMER_STATE_INACTIVE 0x00
9587 #define HRTIMER_STATE_ENQUEUED 0x01
9688
97−/**
98− * struct hrtimer - the basic hrtimer structure
99− * @node: timerqueue node, which also manages node.expires,
100− * the absolute expiry time in the hrtimers internal
101− * representation. The time is related to the clock on
102− * which the timer is based. Is setup by adding
103− * slack to the _softexpires value. For non range timers
104− * identical to _softexpires.
105− * @_softexpires: the absolute earliest expiry time of the hrtimer.
106− * The time which was given as expiry time when the timer
107− * was armed.
108− * @function: timer expiry callback function
109− * @base: pointer to the timer base (per cpu and per clock)
110− * @state: state information (See bit values above)
111− * @is_rel: Set if the timer was armed relative
112− * @is_soft: Set if hrtimer will be expired in soft interrupt context.
113− * @is_hard: Set if hrtimer will be expired in hard interrupt context
114− * even on RT.
115− *
116− * The hrtimer structure must be initialized by hrtimer_init()
117− */
118−struct hrtimer {
119− struct timerqueue_node node;
120− ktime_t _softexpires;
121− enum hrtimer_restart (*function)(struct hrtimer *);
122− struct hrtimer_clock_base *base;
123− u8 state;
124− u8 is_rel;
125− u8 is_soft;
126− u8 is_hard;
127−};
128−
12989 /**
13090 * struct hrtimer_sleeper - simple sleeper structure
13191 * @timer: embedded timer structure
include/linux/hrtimer_types.h+50−0
@@ -0,0 +1,50 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_HRTIMER_TYPES_H
3+#define _LINUX_HRTIMER_TYPES_H
4+
5+#include <linux/types.h>
6+#include <linux/timerqueue_types.h>
7+
8+struct hrtimer_clock_base;
9+
10+/*
11+ * Return values for the callback function
12+ */
13+enum hrtimer_restart {
14+ HRTIMER_NORESTART, /* Timer is not restarted */
15+ HRTIMER_RESTART, /* Timer must be restarted */
16+};
17+
18+/**
19+ * struct hrtimer - the basic hrtimer structure
20+ * @node: timerqueue node, which also manages node.expires,
21+ * the absolute expiry time in the hrtimers internal
22+ * representation. The time is related to the clock on
23+ * which the timer is based. Is setup by adding
24+ * slack to the _softexpires value. For non range timers
25+ * identical to _softexpires.
26+ * @_softexpires: the absolute earliest expiry time of the hrtimer.
27+ * The time which was given as expiry time when the timer
28+ * was armed.
29+ * @function: timer expiry callback function
30+ * @base: pointer to the timer base (per cpu and per clock)
31+ * @state: state information (See bit values above)
32+ * @is_rel: Set if the timer was armed relative
33+ * @is_soft: Set if hrtimer will be expired in soft interrupt context.
34+ * @is_hard: Set if hrtimer will be expired in hard interrupt context
35+ * even on RT.
36+ *
37+ * The hrtimer structure must be initialized by hrtimer_init()
38+ */
39+struct hrtimer {
40+ struct timerqueue_node node;
41+ ktime_t _softexpires;
42+ enum hrtimer_restart (*function)(struct hrtimer *);
43+ struct hrtimer_clock_base *base;
44+ u8 state;
45+ u8 is_rel;
46+ u8 is_soft;
47+ u8 is_hard;
48+};
49+
50+#endif /* _LINUX_HRTIMER_TYPES_H */
include/linux/ipc.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _LINUX_IPC_H
33 #define _LINUX_IPC_H
44
5−#include <linux/spinlock.h>
5+#include <linux/spinlock_types.h>
66 #include <linux/uidgid.h>
77 #include <linux/rhashtable-types.h>
88 #include <uapi/linux/ipc.h>
include/linux/irqflags.h+1−13
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #ifndef _LINUX_TRACE_IRQFLAGS_H
1313 #define _LINUX_TRACE_IRQFLAGS_H
1414
15+#include <linux/irqflags_types.h>
1516 #include <linux/typecheck.h>
1617 #include <linux/cleanup.h>
1718 #include <asm/irqflags.h>
@@ -34,19 +35,6 @@ · 16 unmodified lines
3435
3536 #ifdef CONFIG_TRACE_IRQFLAGS
3637
37−/* Per-task IRQ trace events information. */
38−struct irqtrace_events {
39− unsigned int irq_events;
40− unsigned long hardirq_enable_ip;
41− unsigned long hardirq_disable_ip;
42− unsigned int hardirq_enable_event;
43− unsigned int hardirq_disable_event;
44− unsigned long softirq_disable_ip;
45− unsigned long softirq_enable_ip;
46− unsigned int softirq_disable_event;
47− unsigned int softirq_enable_event;
48−};
49−
5038 DECLARE_PER_CPU(int, hardirqs_enabled);
5139 DECLARE_PER_CPU(int, hardirq_context);
5240
include/linux/irqflags_types.h+22−0
@@ -0,0 +1,22 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_IRQFLAGS_TYPES_H
3+#define _LINUX_IRQFLAGS_TYPES_H
4+
5+#ifdef CONFIG_TRACE_IRQFLAGS
6+
7+/* Per-task IRQ trace events information. */
8+struct irqtrace_events {
9+ unsigned int irq_events;
10+ unsigned long hardirq_enable_ip;
11+ unsigned long hardirq_disable_ip;
12+ unsigned int hardirq_enable_event;
13+ unsigned int hardirq_disable_event;
14+ unsigned long softirq_disable_ip;
15+ unsigned long softirq_enable_ip;
16+ unsigned int softirq_disable_event;
17+ unsigned int softirq_enable_event;
18+};
19+
20+#endif
21+
22+#endif /* _LINUX_IRQFLAGS_TYPES_H */
include/linux/kmsan_types.h+2−0
@@ -9,6 +9,8 @@ · 8 unmodified lines
99 #ifndef _LINUX_KMSAN_TYPES_H
1010 #define _LINUX_KMSAN_TYPES_H
1111
12+#include <linux/types.h>
13+
1214 /* These constants are defined in the MSan LLVM instrumentation pass. */
1315 #define KMSAN_RETVAL_SIZE 800
1416 #define KMSAN_PARAM_SIZE 800
include/linux/ktime.h+3−5
@@ -21,12 +21,10 @@ · 20 unmodified lines
2121 #ifndef _LINUX_KTIME_H
2222 #define _LINUX_KTIME_H
2323
24−#include <linux/time.h>
25−#include <linux/jiffies.h>
2624 #include <asm/bug.h>
27−
28−/* Nanosecond scalar representation for kernel time values */
29−typedef s64 ktime_t;
25+#include <linux/jiffies.h>
26+#include <linux/time.h>
27+#include <linux/types.h>
3028
3129 /**
3230 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
include/linux/lockdep.h+0−57
@@ -82,63 +82,6 @@ struct lock_chain { · 81 unmodified lines
8282 u64 chain_key;
8383 };
8484
85−#define MAX_LOCKDEP_KEYS_BITS 13
86−#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
87−#define INITIAL_CHAIN_KEY -1
88−
89−struct held_lock {
90− /*
91− * One-way hash of the dependency chain up to this point. We
92− * hash the hashes step by step as the dependency chain grows.
93− *
94− * We use it for dependency-caching and we skip detection
95− * passes and dependency-updates if there is a cache-hit, so
96− * it is absolutely critical for 100% coverage of the validator
97− * to have a unique key value for every unique dependency path
98− * that can occur in the system, to make a unique hash value
99− * as likely as possible - hence the 64-bit width.
100− *
101− * The task struct holds the current hash value (initialized
102− * with zero), here we store the previous hash value:
103− */
104− u64 prev_chain_key;
105− unsigned long acquire_ip;
106− struct lockdep_map *instance;
107− struct lockdep_map *nest_lock;
108−#ifdef CONFIG_LOCK_STAT
109− u64 waittime_stamp;
110− u64 holdtime_stamp;
111−#endif
112− /*
113− * class_idx is zero-indexed; it points to the element in
114− * lock_classes this held lock instance belongs to. class_idx is in
115− * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive.
116− */
117− unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS;
118− /*
119− * The lock-stack is unified in that the lock chains of interrupt
120− * contexts nest ontop of process context chains, but we 'separate'
121− * the hashes by starting with 0 if we cross into an interrupt
122− * context, and we also keep do not add cross-context lock
123− * dependencies - the lock usage graph walking covers that area
124− * anyway, and we'd just unnecessarily increase the number of
125− * dependencies otherwise. [Note: hardirq and softirq contexts
126− * are separated from each other too.]
127− *
128− * The following field is used to detect when we cross into an
129− * interrupt context:
130− */
131− unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */
132− unsigned int trylock:1; /* 16 bits */
133−
134− unsigned int read:2; /* see lock_acquire() comment */
135− unsigned int check:1; /* see lock_acquire() comment */
136− unsigned int hardirqs_off:1;
137− unsigned int sync:1;
138− unsigned int references:11; /* 32 bits */
139− unsigned int pin_count;
140−};
141−
14285 /*
14386 * Initialization, self-test and debugging-output methods:
14487 */
include/linux/lockdep_types.h+57−0
@@ -198,6 +198,63 @@ struct lockdep_map { · 197 unmodified lines
198198
199199 struct pin_cookie { unsigned int val; };
200200
201+#define MAX_LOCKDEP_KEYS_BITS 13
202+#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
203+#define INITIAL_CHAIN_KEY -1
204+
205+struct held_lock {
206+ /*
207+ * One-way hash of the dependency chain up to this point. We
208+ * hash the hashes step by step as the dependency chain grows.
209+ *
210+ * We use it for dependency-caching and we skip detection
211+ * passes and dependency-updates if there is a cache-hit, so
212+ * it is absolutely critical for 100% coverage of the validator
213+ * to have a unique key value for every unique dependency path
214+ * that can occur in the system, to make a unique hash value
215+ * as likely as possible - hence the 64-bit width.
216+ *
217+ * The task struct holds the current hash value (initialized
218+ * with zero), here we store the previous hash value:
219+ */
220+ u64 prev_chain_key;
221+ unsigned long acquire_ip;
222+ struct lockdep_map *instance;
223+ struct lockdep_map *nest_lock;
224+#ifdef CONFIG_LOCK_STAT
225+ u64 waittime_stamp;
226+ u64 holdtime_stamp;
227+#endif
228+ /*
229+ * class_idx is zero-indexed; it points to the element in
230+ * lock_classes this held lock instance belongs to. class_idx is in
231+ * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive.
232+ */
233+ unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS;
234+ /*
235+ * The lock-stack is unified in that the lock chains of interrupt
236+ * contexts nest ontop of process context chains, but we 'separate'
237+ * the hashes by starting with 0 if we cross into an interrupt
238+ * context, and we also keep do not add cross-context lock
239+ * dependencies - the lock usage graph walking covers that area
240+ * anyway, and we'd just unnecessarily increase the number of
241+ * dependencies otherwise. [Note: hardirq and softirq contexts
242+ * are separated from each other too.]
243+ *
244+ * The following field is used to detect when we cross into an
245+ * interrupt context:
246+ */
247+ unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */
248+ unsigned int trylock:1; /* 16 bits */
249+
250+ unsigned int read:2; /* see lock_acquire() comment */
251+ unsigned int check:1; /* see lock_acquire() comment */
252+ unsigned int hardirqs_off:1;
253+ unsigned int sync:1;
254+ unsigned int references:11; /* 32 bits */
255+ unsigned int pin_count;
256+};
257+
201258 #else /* !CONFIG_LOCKDEP */
202259
203260 /*
include/linux/mm_types_task.h+2−3
@@ -9,9 +9,6 @@ · 8 unmodified lines
99 */
1010
1111 #include <linux/types.h>
12−#include <linux/threads.h>
13−#include <linux/atomic.h>
14−#include <linux/cpumask.h>
1512
1613 #include <asm/page.h>
1714
@@ -36,6 +33,8 @@ enum { · 18 unmodified lines
3633 NR_MM_COUNTERS
3734 };
3835
36+struct page;
37+
3938 struct page_frag {
4039 struct page *page;
4140 #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
include/linux/mutex.h+1−51
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/osq_lock.h>
2121 #include <linux/debug_locks.h>
2222 #include <linux/cleanup.h>
23+#include <linux/mutex_types.h>
2324
2425 #ifdef CONFIG_DEBUG_LOCK_ALLOC
2526 # define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
@@ -33,49 +34,6 @@ · 7 unmodified lines
3334
3435 #ifndef CONFIG_PREEMPT_RT
3536
36−/*
37− * Simple, straightforward mutexes with strict semantics:
38− *
39− * - only one task can hold the mutex at a time
40− * - only the owner can unlock the mutex
41− * - multiple unlocks are not permitted
42− * - recursive locking is not permitted
43− * - a mutex object must be initialized via the API
44− * - a mutex object must not be initialized via memset or copying
45− * - task may not exit with mutex held
46− * - memory areas where held locks reside must not be freed
47− * - held mutexes must not be reinitialized
48− * - mutexes may not be used in hardware or software interrupt
49− * contexts such as tasklets and timers
50− *
51− * These semantics are fully enforced when DEBUG_MUTEXES is
52− * enabled. Furthermore, besides enforcing the above rules, the mutex
53− * debugging code also implements a number of additional features
54− * that make lock debugging easier and faster:
55− *
56− * - uses symbolic names of mutexes, whenever they are printed in debug output
57− * - point-of-acquire tracking, symbolic lookup of function names
58− * - list of all locks held in the system, printout of them
59− * - owner tracking
60− * - detects self-recursing locks and prints out all relevant info
61− * - detects multi-task circular deadlocks and prints out all affected
62− * locks and tasks (and only those tasks)
63− */
64−struct mutex {
65− atomic_long_t owner;
66− raw_spinlock_t wait_lock;
67−#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
68− struct optimistic_spin_queue osq; /* Spinner MCS lock */
69−#endif
70− struct list_head wait_list;
71−#ifdef CONFIG_DEBUG_MUTEXES
72− void *magic;
73−#endif
74−#ifdef CONFIG_DEBUG_LOCK_ALLOC
75− struct lockdep_map dep_map;
76−#endif
77−};
78−
7937 #ifdef CONFIG_DEBUG_MUTEXES
8038
8139 #define __DEBUG_MUTEX_INITIALIZER(lockname) \
@@ -131,14 +89,6 @@ extern bool mutex_is_locked(struct mutex *lock); · 49 unmodified lines
13189 /*
13290 * Preempt-RT variant based on rtmutexes.
13391 */
134−#include <linux/rtmutex.h>
135−
136−struct mutex {
137− struct rt_mutex_base rtmutex;
138−#ifdef CONFIG_DEBUG_LOCK_ALLOC
139− struct lockdep_map dep_map;
140−#endif
141−};
14292
14393 #define __MUTEX_INITIALIZER(mutexname) \
14494 { \
include/linux/mutex_types.h+71−0
@@ -0,0 +1,71 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __LINUX_MUTEX_TYPES_H
3+#define __LINUX_MUTEX_TYPES_H
4+
5+#include <linux/atomic.h>
6+#include <linux/lockdep_types.h>
7+#include <linux/osq_lock.h>
8+#include <linux/spinlock_types.h>
9+#include <linux/types.h>
10+
11+#ifndef CONFIG_PREEMPT_RT
12+
13+/*
14+ * Simple, straightforward mutexes with strict semantics:
15+ *
16+ * - only one task can hold the mutex at a time
17+ * - only the owner can unlock the mutex
18+ * - multiple unlocks are not permitted
19+ * - recursive locking is not permitted
20+ * - a mutex object must be initialized via the API
21+ * - a mutex object must not be initialized via memset or copying
22+ * - task may not exit with mutex held
23+ * - memory areas where held locks reside must not be freed
24+ * - held mutexes must not be reinitialized
25+ * - mutexes may not be used in hardware or software interrupt
26+ * contexts such as tasklets and timers
27+ *
28+ * These semantics are fully enforced when DEBUG_MUTEXES is
29+ * enabled. Furthermore, besides enforcing the above rules, the mutex
30+ * debugging code also implements a number of additional features
31+ * that make lock debugging easier and faster:
32+ *
33+ * - uses symbolic names of mutexes, whenever they are printed in debug output
34+ * - point-of-acquire tracking, symbolic lookup of function names
35+ * - list of all locks held in the system, printout of them
36+ * - owner tracking
37+ * - detects self-recursing locks and prints out all relevant info
38+ * - detects multi-task circular deadlocks and prints out all affected
39+ * locks and tasks (and only those tasks)
40+ */
41+struct mutex {
42+ atomic_long_t owner;
43+ raw_spinlock_t wait_lock;
44+#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
45+ struct optimistic_spin_queue osq; /* Spinner MCS lock */
46+#endif
47+ struct list_head wait_list;
48+#ifdef CONFIG_DEBUG_MUTEXES
49+ void *magic;
50+#endif
51+#ifdef CONFIG_DEBUG_LOCK_ALLOC
52+ struct lockdep_map dep_map;
53+#endif
54+};
55+
56+#else /* !CONFIG_PREEMPT_RT */
57+/*
58+ * Preempt-RT variant based on rtmutexes.
59+ */
60+#include <linux/rtmutex.h>
61+
62+struct mutex {
63+ struct rt_mutex_base rtmutex;
64+#ifdef CONFIG_DEBUG_LOCK_ALLOC
65+ struct lockdep_map dep_map;
66+#endif
67+};
68+
69+#endif /* CONFIG_PREEMPT_RT */
70+
71+#endif /* __LINUX_MUTEX_TYPES_H */
include/linux/nodemask.h+1−1
@@ -93,10 +93,10 @@ · 92 unmodified lines
9393 #include <linux/threads.h>
9494 #include <linux/bitmap.h>
9595 #include <linux/minmax.h>
96+#include <linux/nodemask_types.h>
9697 #include <linux/numa.h>
9798 #include <linux/random.h>
9899
99−typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
100100 extern nodemask_t _unused_nodemask_arg_;
101101
102102 /**
include/linux/nodemask_types.h+10−0
@@ -0,0 +1,10 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __LINUX_NODEMASK_TYPES_H
3+#define __LINUX_NODEMASK_TYPES_H
4+
5+#include <linux/bitops.h>
6+#include <linux/numa.h>
7+
8+typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
9+
10+#endif /* __LINUX_NODEMASK_TYPES_H */
include/linux/nsproxy.h+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #ifndef _LINUX_NSPROXY_H
33 #define _LINUX_NSPROXY_H
44
5+#include <linux/refcount.h>
56 #include <linux/spinlock.h>
67 #include <linux/sched.h>
78
include/linux/numa.h+6−13
@@ -1,6 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef _LINUX_NUMA_H
33 #define _LINUX_NUMA_H
4+#include <linux/init.h>
45 #include <linux/types.h>
56
67 #ifdef CONFIG_NODES_SHIFT
@@ -22,34 +23,26 @@ · 15 unmodified lines
2223 #endif
2324
2425 #ifdef CONFIG_NUMA
25−#include <linux/printk.h>
2626 #include <asm/sparsemem.h>
2727
2828 /* Generic implementation available */
2929 int numa_nearest_node(int node, unsigned int state);
3030
3131 #ifndef memory_add_physaddr_to_nid
32−static inline int memory_add_physaddr_to_nid(u64 start)
33−{
34− pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
35− start);
36− return 0;
37−}
32+int memory_add_physaddr_to_nid(u64 start);
3833 #endif
34+
3935 #ifndef phys_to_target_node
40−static inline int phys_to_target_node(u64 start)
41−{
42− pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
43− start);
44− return 0;
45−}
36+int phys_to_target_node(u64 start);
4637 #endif
38+
4739 #ifndef numa_fill_memblks
4840 static inline int __init numa_fill_memblks(u64 start, u64 end)
4941 {
5042 return NUMA_NO_MEMBLK;
5143 }
5244 #endif
45+
5346 #else /* !CONFIG_NUMA */
5447 static inline int numa_nearest_node(int node, unsigned int state)
5548 {
include/linux/pid.h+127−13
@@ -2,18 +2,12 @@ · 1 unmodified line
22 #ifndef _LINUX_PID_H
33 #define _LINUX_PID_H
44
5+#include <linux/pid_types.h>
56 #include <linux/rculist.h>
6−#include <linux/wait.h>
7+#include <linux/rcupdate.h>
78 #include <linux/refcount.h>
8−
9−enum pid_type
10−{
11− PIDTYPE_PID,
12− PIDTYPE_TGID,
13− PIDTYPE_PGID,
14− PIDTYPE_SID,
15− PIDTYPE_MAX,
16−};
9+#include <linux/sched.h>
10+#include <linux/wait.h>
1711
1812 /*
1913 * What is struct pid?
@@ -110,9 +104,6 @@ extern void exchange_tids(struct task_struct *task, struct task_struct *old); · 90 unmodified lines
110104 extern void transfer_pid(struct task_struct *old, struct task_struct *new,
111105 enum pid_type);
112106
113−struct pid_namespace;
114−extern struct pid_namespace init_pid_ns;
115−
116107 extern int pid_max;
117108 extern int pid_max_min, pid_max_max;
118109
@@ -215,4 +206,127 @@ pid_t pid_vnr(struct pid *pid); · 96 unmodified lines
215206 } \
216207 task = tg___; \
217208 } while_each_pid_task(pid, type, task)
209+
210+static inline struct pid *task_pid(struct task_struct *task)
211+{
212+ return task->thread_pid;
213+}
214+
215+/*
216+ * the helpers to get the task's different pids as they are seen
217+ * from various namespaces
218+ *
219+ * task_xid_nr() : global id, i.e. the id seen from the init namespace;
220+ * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of
221+ * current.
222+ * task_xid_nr_ns() : id seen from the ns specified;
223+ *
224+ * see also pid_nr() etc in include/linux/pid.h
225+ */
226+pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns);
227+
228+static inline pid_t task_pid_nr(struct task_struct *tsk)
229+{
230+ return tsk->pid;
231+}
232+
233+static inline pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
234+{
235+ return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
236+}
237+
238+static inline pid_t task_pid_vnr(struct task_struct *tsk)
239+{
240+ return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
241+}
242+
243+
244+static inline pid_t task_tgid_nr(struct task_struct *tsk)
245+{
246+ return tsk->tgid;
247+}
248+
249+/**
250+ * pid_alive - check that a task structure is not stale
251+ * @p: Task structure to be checked.
252+ *
253+ * Test if a process is not yet dead (at most zombie state)
254+ * If pid_alive fails, then pointers within the task structure
255+ * can be stale and must not be dereferenced.
256+ *
257+ * Return: 1 if the process is alive. 0 otherwise.
258+ */
259+static inline int pid_alive(const struct task_struct *p)
260+{
261+ return p->thread_pid != NULL;
262+}
263+
264+static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
265+{
266+ return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
267+}
268+
269+static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
270+{
271+ return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
272+}
273+
274+
275+static inline pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
276+{
277+ return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
278+}
279+
280+static inline pid_t task_session_vnr(struct task_struct *tsk)
281+{
282+ return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
283+}
284+
285+static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
286+{
287+ return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns);
288+}
289+
290+static inline pid_t task_tgid_vnr(struct task_struct *tsk)
291+{
292+ return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
293+}
294+
295+static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
296+{
297+ pid_t pid = 0;
298+
299+ rcu_read_lock();
300+ if (pid_alive(tsk))
301+ pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
302+ rcu_read_unlock();
303+
304+ return pid;
305+}
306+
307+static inline pid_t task_ppid_nr(const struct task_struct *tsk)
308+{
309+ return task_ppid_nr_ns(tsk, &init_pid_ns);
310+}
311+
312+/* Obsolete, do not use: */
313+static inline pid_t task_pgrp_nr(struct task_struct *tsk)
314+{
315+ return task_pgrp_nr_ns(tsk, &init_pid_ns);
316+}
317+
318+/**
319+ * is_global_init - check if a task structure is init. Since init
320+ * is free to have sub-threads we need to check tgid.
321+ * @tsk: Task structure to be checked.
322+ *
323+ * Check if a task structure is the first user space task the kernel created.
324+ *
325+ * Return: 1 if the task structure is init. 0 otherwise.
326+ */
327+static inline int is_global_init(struct task_struct *tsk)
328+{
329+ return task_tgid_nr(tsk) == 1;
330+}
331+
218332 #endif /* _LINUX_PID_H */
include/linux/pid_types.h+16−0
@@ -0,0 +1,16 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_PID_TYPES_H
3+#define _LINUX_PID_TYPES_H
4+
5+enum pid_type {
6+ PIDTYPE_PID,
7+ PIDTYPE_TGID,
8+ PIDTYPE_PGID,
9+ PIDTYPE_SID,
10+ PIDTYPE_MAX,
11+};
12+
13+struct pid_namespace;
14+extern struct pid_namespace init_pid_ns;
15+
16+#endif /* _LINUX_PID_TYPES_H */
include/linux/plist.h+1−11
@@ -75,20 +75,10 @@ · 74 unmodified lines
7575
7676 #include <linux/container_of.h>
7777 #include <linux/list.h>
78−#include <linux/types.h>
78+#include <linux/plist_types.h>
7979
8080 #include <asm/bug.h>
8181
82−struct plist_head {
83− struct list_head node_list;
84−};
85−
86−struct plist_node {
87− int prio;
88− struct list_head prio_list;
89− struct list_head node_list;
90−};
91−
9282 /**
9383 * PLIST_HEAD_INIT - static struct plist_head initializer
9484 * @head: struct plist_head variable name
include/linux/plist_types.h+17−0
@@ -0,0 +1,17 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+#ifndef _LINUX_PLIST_TYPES_H
3+#define _LINUX_PLIST_TYPES_H
4+
5+#include <linux/types.h>
6+
7+struct plist_head {
8+ struct list_head node_list;
9+};
10+
11+struct plist_node {
12+ int prio;
13+ struct list_head prio_list;
14+ struct list_head node_list;
15+};
16+
17+#endif /* _LINUX_PLIST_TYPES_H */
include/linux/posix-timers.h+3−66
@@ -2,40 +2,16 @@ · 1 unmodified line
22 #ifndef _linux_POSIX_TIMERS_H
33 #define _linux_POSIX_TIMERS_H
44
5−#include <linux/spinlock.h>
5+#include <linux/alarmtimer.h>
66 #include <linux/list.h>
77 #include <linux/mutex.h>
8−#include <linux/alarmtimer.h>
8+#include <linux/posix-timers_types.h>
9+#include <linux/spinlock.h>
910 #include <linux/timerqueue.h>
1011
1112 struct kernel_siginfo;
1213 struct task_struct;
1314
14−/*
15− * Bit fields within a clockid:
16− *
17− * The most significant 29 bits hold either a pid or a file descriptor.
18− *
19− * Bit 2 indicates whether a cpu clock refers to a thread or a process.
20− *
21− * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
22− *
23− * A clockid is invalid if bits 2, 1, and 0 are all set.
24− */
25−#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
26−#define CPUCLOCK_PERTHREAD(clock) \
27− (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
28−
29−#define CPUCLOCK_PERTHREAD_MASK 4
30−#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
31−#define CPUCLOCK_CLOCK_MASK 3
32−#define CPUCLOCK_PROF 0
33−#define CPUCLOCK_VIRT 1
34−#define CPUCLOCK_SCHED 2
35−#define CPUCLOCK_MAX 3
36−#define CLOCKFD CPUCLOCK_MAX
37−#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
38−
3915 static inline clockid_t make_process_cpuclock(const unsigned int pid,
4016 const clockid_t clock)
4117 {
@@ -109,44 +85,6 @@ static inline void cpu_timer_setexpires(struct cpu_timer *ctmr, u64 exp) · 67 unmodified lines
10985 ctmr->node.expires = exp;
11086 }
11187
112−/**
113− * posix_cputimer_base - Container per posix CPU clock
114− * @nextevt: Earliest-expiration cache
115− * @tqhead: timerqueue head for cpu_timers
116− */
117−struct posix_cputimer_base {
118− u64 nextevt;
119− struct timerqueue_head tqhead;
120−};
121−
122−/**
123− * posix_cputimers - Container for posix CPU timer related data
124− * @bases: Base container for posix CPU clocks
125− * @timers_active: Timers are queued.
126− * @expiry_active: Timer expiry is active. Used for
127− * process wide timers to avoid multiple
128− * task trying to handle expiry concurrently
129− *
130− * Used in task_struct and signal_struct
131− */
132−struct posix_cputimers {
133− struct posix_cputimer_base bases[CPUCLOCK_MAX];
134− unsigned int timers_active;
135− unsigned int expiry_active;
136−};
137−
138−/**
139− * posix_cputimers_work - Container for task work based posix CPU timer expiry
140− * @work: The task work to be scheduled
141− * @mutex: Mutex held around expiry in context of this task work
142− * @scheduled: @work has been scheduled already, no further processing
143− */
144−struct posix_cputimers_work {
145− struct callback_head work;
146− struct mutex mutex;
147− unsigned int scheduled;
148−};
149−
15088 static inline void posix_cputimers_init(struct posix_cputimers *pct)
15189 {
15290 memset(pct, 0, sizeof(*pct));
@@ -179,7 +117,6 @@ static inline void posix_cputimers_rt_watchdog(struct posix_cputimers *pct, · 26 unmodified lines
179117 .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \
180118 },
181119 #else
182−struct posix_cputimers { };
183120 struct cpu_timer { };
184121 #define INIT_CPU_TIMERS(s)
185122 static inline void posix_cputimers_init(struct posix_cputimers *pct) { }
include/linux/posix-timers_types.h+80−0
@@ -0,0 +1,80 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _linux_POSIX_TIMERS_TYPES_H
3+#define _linux_POSIX_TIMERS_TYPES_H
4+
5+#include <linux/mutex_types.h>
6+#include <linux/timerqueue_types.h>
7+#include <linux/types.h>
8+
9+/*
10+ * Bit fields within a clockid:
11+ *
12+ * The most significant 29 bits hold either a pid or a file descriptor.
13+ *
14+ * Bit 2 indicates whether a cpu clock refers to a thread or a process.
15+ *
16+ * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
17+ *
18+ * A clockid is invalid if bits 2, 1, and 0 are all set.
19+ */
20+#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
21+#define CPUCLOCK_PERTHREAD(clock) \
22+ (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
23+
24+#define CPUCLOCK_PERTHREAD_MASK 4
25+#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
26+#define CPUCLOCK_CLOCK_MASK 3
27+#define CPUCLOCK_PROF 0
28+#define CPUCLOCK_VIRT 1
29+#define CPUCLOCK_SCHED 2
30+#define CPUCLOCK_MAX 3
31+#define CLOCKFD CPUCLOCK_MAX
32+#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
33+
34+#ifdef CONFIG_POSIX_TIMERS
35+
36+/**
37+ * posix_cputimer_base - Container per posix CPU clock
38+ * @nextevt: Earliest-expiration cache
39+ * @tqhead: timerqueue head for cpu_timers
40+ */
41+struct posix_cputimer_base {
42+ u64 nextevt;
43+ struct timerqueue_head tqhead;
44+};
45+
46+/**
47+ * posix_cputimers - Container for posix CPU timer related data
48+ * @bases: Base container for posix CPU clocks
49+ * @timers_active: Timers are queued.
50+ * @expiry_active: Timer expiry is active. Used for
51+ * process wide timers to avoid multiple
52+ * task trying to handle expiry concurrently
53+ *
54+ * Used in task_struct and signal_struct
55+ */
56+struct posix_cputimers {
57+ struct posix_cputimer_base bases[CPUCLOCK_MAX];
58+ unsigned int timers_active;
59+ unsigned int expiry_active;
60+};
61+
62+/**
63+ * posix_cputimers_work - Container for task work based posix CPU timer expiry
64+ * @work: The task work to be scheduled
65+ * @mutex: Mutex held around expiry in context of this task work
66+ * @scheduled: @work has been scheduled already, no further processing
67+ */
68+struct posix_cputimers_work {
69+ struct callback_head work;
70+ struct mutex mutex;
71+ unsigned int scheduled;
72+};
73+
74+#else /* CONFIG_POSIX_TIMERS */
75+
76+struct posix_cputimers { };
77+
78+#endif /* CONFIG_POSIX_TIMERS */
79+
80+#endif /* _linux_POSIX_TIMERS_TYPES_H */
include/linux/prandom.h+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010
1111 #include <linux/types.h>
1212 #include <linux/once.h>
13−#include <linux/percpu.h>
1413 #include <linux/random.h>
1514
1615 struct rnd_state {
include/linux/preempt.h+4−2
@@ -9,7 +9,7 @@ · 8 unmodified lines
99
1010 #include <linux/linkage.h>
1111 #include <linux/cleanup.h>
12−#include <linux/list.h>
12+#include <linux/types.h>
1313
1414 /*
1515 * We put the hardirq and softirq counter into the preemption
@@ -360,7 +360,9 @@ void preempt_notifier_unregister(struct preempt_notifier *notifier); · 344 unmodified lines
360360 static inline void preempt_notifier_init(struct preempt_notifier *notifier,
361361 struct preempt_ops *ops)
362362 {
363− INIT_HLIST_NODE(&notifier->link);
363+ /* INIT_HLIST_NODE() open coded, to avoid dependency on list.h */
364+ notifier->link.next = NULL;
365+ notifier->link.pprev = NULL;
364366 notifier->ops = ops;
365367 }
366368
include/linux/rcupdate_wait.h+10−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/rcupdate.h>
1010 #include <linux/completion.h>
11+#include <linux/sched.h>
1112
1213 /*
1314 * Structure allowing asynchronous waiting on RCU.
@@ -55,4 +56,13 @@ do { \ · 41 unmodified lines
5556 #define synchronize_rcu_mult(...) \
5657 _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__)
5758
59+static inline void cond_resched_rcu(void)
60+{
61+#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
62+ rcu_read_unlock();
63+ cond_resched();
64+ rcu_read_lock();
65+#endif
66+}
67+
5868 #endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */
include/linux/refcount.h+1−12
@@ -96,22 +96,11 @@ · 95 unmodified lines
9696 #include <linux/bug.h>
9797 #include <linux/compiler.h>
9898 #include <linux/limits.h>
99+#include <linux/refcount_types.h>
99100 #include <linux/spinlock_types.h>
100101
101102 struct mutex;
102103
103−/**
104− * typedef refcount_t - variant of atomic_t specialized for reference counts
105− * @refs: atomic_t counter field
106− *
107− * The counter saturates at REFCOUNT_SATURATED and will not move once
108− * there. This avoids wrapping the counter and causing 'spurious'
109− * use-after-free bugs.
110− */
111−typedef struct refcount_struct {
112− atomic_t refs;
113−} refcount_t;
114−
115104 #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), }
116105 #define REFCOUNT_MAX INT_MAX
117106 #define REFCOUNT_SATURATED (INT_MIN / 2)
include/linux/refcount_types.h+19−0
@@ -0,0 +1,19 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_REFCOUNT_TYPES_H
3+#define _LINUX_REFCOUNT_TYPES_H
4+
5+#include <linux/types.h>
6+
7+/**
8+ * typedef refcount_t - variant of atomic_t specialized for reference counts
9+ * @refs: atomic_t counter field
10+ *
11+ * The counter saturates at REFCOUNT_SATURATED and will not move once
12+ * there. This avoids wrapping the counter and causing 'spurious'
13+ * use-after-free bugs.
14+ */
15+typedef struct refcount_struct {
16+ atomic_t refs;
17+} refcount_t;
18+
19+#endif /* _LINUX_REFCOUNT_TYPES_H */
include/linux/restart_block.h+1−1
@@ -7,8 +7,8 @@ · 6 unmodified lines
77
88 #include <linux/compiler.h>
99 #include <linux/types.h>
10−#include <linux/time64.h>
1110
11+struct __kernel_timespec;
1212 struct timespec;
1313 struct old_timespec32;
1414 struct pollfd;
include/linux/resume_user_mode.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/sched.h>
77 #include <linux/task_work.h>
88 #include <linux/memcontrol.h>
9+#include <linux/rseq.h>
910 #include <linux/blk-cgroup.h>
1011
1112 /**
include/linux/rhashtable-types.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #include <linux/atomic.h>
1313 #include <linux/compiler.h>
1414 #include <linux/mutex.h>
15−#include <linux/workqueue.h>
15+#include <linux/workqueue_types.h>
1616
1717 struct rhash_head {
1818 struct rhash_head __rcu *next;
include/linux/rseq.h+131−0
@@ -0,0 +1,131 @@
1+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2+#ifndef _LINUX_RSEQ_H
3+#define _LINUX_RSEQ_H
4+
5+#ifdef CONFIG_RSEQ
6+
7+#include <linux/preempt.h>
8+#include <linux/sched.h>
9+
10+/*
11+ * Map the event mask on the user-space ABI enum rseq_cs_flags
12+ * for direct mask checks.
13+ */
14+enum rseq_event_mask_bits {
15+ RSEQ_EVENT_PREEMPT_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT,
16+ RSEQ_EVENT_SIGNAL_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT,
17+ RSEQ_EVENT_MIGRATE_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT,
18+};
19+
20+enum rseq_event_mask {
21+ RSEQ_EVENT_PREEMPT = (1U << RSEQ_EVENT_PREEMPT_BIT),
22+ RSEQ_EVENT_SIGNAL = (1U << RSEQ_EVENT_SIGNAL_BIT),
23+ RSEQ_EVENT_MIGRATE = (1U << RSEQ_EVENT_MIGRATE_BIT),
24+};
25+
26+static inline void rseq_set_notify_resume(struct task_struct *t)
27+{
28+ if (t->rseq)
29+ set_tsk_thread_flag(t, TIF_NOTIFY_RESUME);
30+}
31+
32+void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs);
33+
34+static inline void rseq_handle_notify_resume(struct ksignal *ksig,
35+ struct pt_regs *regs)
36+{
37+ if (current->rseq)
38+ __rseq_handle_notify_resume(ksig, regs);
39+}
40+
41+static inline void rseq_signal_deliver(struct ksignal *ksig,
42+ struct pt_regs *regs)
43+{
44+ preempt_disable();
45+ __set_bit(RSEQ_EVENT_SIGNAL_BIT, &current->rseq_event_mask);
46+ preempt_enable();
47+ rseq_handle_notify_resume(ksig, regs);
48+}
49+
50+/* rseq_preempt() requires preemption to be disabled. */
51+static inline void rseq_preempt(struct task_struct *t)
52+{
53+ __set_bit(RSEQ_EVENT_PREEMPT_BIT, &t->rseq_event_mask);
54+ rseq_set_notify_resume(t);
55+}
56+
57+/* rseq_migrate() requires preemption to be disabled. */
58+static inline void rseq_migrate(struct task_struct *t)
59+{
60+ __set_bit(RSEQ_EVENT_MIGRATE_BIT, &t->rseq_event_mask);
61+ rseq_set_notify_resume(t);
62+}
63+
64+/*
65+ * If parent process has a registered restartable sequences area, the
66+ * child inherits. Unregister rseq for a clone with CLONE_VM set.
67+ */
68+static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
69+{
70+ if (clone_flags & CLONE_VM) {
71+ t->rseq = NULL;
72+ t->rseq_len = 0;
73+ t->rseq_sig = 0;
74+ t->rseq_event_mask = 0;
75+ } else {
76+ t->rseq = current->rseq;
77+ t->rseq_len = current->rseq_len;
78+ t->rseq_sig = current->rseq_sig;
79+ t->rseq_event_mask = current->rseq_event_mask;
80+ }
81+}
82+
83+static inline void rseq_execve(struct task_struct *t)
84+{
85+ t->rseq = NULL;
86+ t->rseq_len = 0;
87+ t->rseq_sig = 0;
88+ t->rseq_event_mask = 0;
89+}
90+
91+#else
92+
93+static inline void rseq_set_notify_resume(struct task_struct *t)
94+{
95+}
96+static inline void rseq_handle_notify_resume(struct ksignal *ksig,
97+ struct pt_regs *regs)
98+{
99+}
100+static inline void rseq_signal_deliver(struct ksignal *ksig,
101+ struct pt_regs *regs)
102+{
103+}
104+static inline void rseq_preempt(struct task_struct *t)
105+{
106+}
107+static inline void rseq_migrate(struct task_struct *t)
108+{
109+}
110+static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
111+{
112+}
113+static inline void rseq_execve(struct task_struct *t)
114+{
115+}
116+
117+#endif
118+
119+#ifdef CONFIG_DEBUG_RSEQ
120+
121+void rseq_syscall(struct pt_regs *regs);
122+
123+#else
124+
125+static inline void rseq_syscall(struct pt_regs *regs)
126+{
127+}
128+
129+#endif
130+
131+#endif /* _LINUX_RSEQ_H */
include/linux/rslib.h+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #ifndef _RSLIB_H_
1111 #define _RSLIB_H_
1212
13−#include <linux/list.h>
1413 #include <linux/types.h> /* for gfp_t */
1514 #include <linux/gfp.h> /* for GFP_KERNEL */
1615
include/linux/sched.h+25−300
@@ -10,33 +10,41 @@ · 9 unmodified lines
1010 #include <uapi/linux/sched.h>
1111
1212 #include <asm/current.h>
13−
14−#include <linux/pid.h>
15−#include <linux/sem.h>
13+#include <asm/processor.h>
14+#include <linux/thread_info.h>
15+#include <linux/preempt.h>
16+#include <linux/cpumask.h>
17+
18+#include <linux/cache.h>
19+#include <linux/irqflags_types.h>
20+#include <linux/smp_types.h>
21+#include <linux/pid_types.h>
22+#include <linux/sem_types.h>
1623 #include <linux/shm.h>
1724 #include <linux/kmsan_types.h>
18−#include <linux/mutex.h>
19−#include <linux/plist.h>
20−#include <linux/hrtimer.h>
21−#include <linux/irqflags.h>
22−#include <linux/seccomp.h>
23−#include <linux/nodemask.h>
24−#include <linux/rcupdate.h>
25−#include <linux/refcount.h>
25+#include <linux/mutex_types.h>
26+#include <linux/plist_types.h>
27+#include <linux/hrtimer_types.h>
28+#include <linux/timer_types.h>
29+#include <linux/seccomp_types.h>
30+#include <linux/nodemask_types.h>
31+#include <linux/refcount_types.h>
2632 #include <linux/resource.h>
2733 #include <linux/latencytop.h>
2834 #include <linux/sched/prio.h>
2935 #include <linux/sched/types.h>
3036 #include <linux/signal_types.h>
31−#include <linux/syscall_user_dispatch.h>
37+#include <linux/syscall_user_dispatch_types.h>
3238 #include <linux/mm_types_task.h>
3339 #include <linux/task_io_accounting.h>
34−#include <linux/posix-timers.h>
35−#include <linux/rseq.h>
36−#include <linux/seqlock.h>
40+#include <linux/posix-timers_types.h>
41+#include <linux/restart_block.h>
42+#include <uapi/linux/rseq.h>
43+#include <linux/seqlock_types.h>
3744 #include <linux/kcsan.h>
3845 #include <linux/rv.h>
3946 #include <linux/livepatch_sched.h>
47+#include <linux/uidgid_types.h>
4048 #include <asm/kmap_size.h>
4149
4250 /* task_struct member predeclarations (sorted alphabetically): */
@@ -1556,114 +1564,6 @@ struct task_struct { · 1513 unmodified lines
15561564 */
15571565 };
15581566
1559−static inline struct pid *task_pid(struct task_struct *task)
1560−{
1561− return task->thread_pid;
1562−}
1563−
1564−/*
1565− * the helpers to get the task's different pids as they are seen
1566− * from various namespaces
1567− *
1568− * task_xid_nr() : global id, i.e. the id seen from the init namespace;
1569− * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of
1570− * current.
1571− * task_xid_nr_ns() : id seen from the ns specified;
1572− *
1573− * see also pid_nr() etc in include/linux/pid.h
1574− */
1575−pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns);
1576−
1577−static inline pid_t task_pid_nr(struct task_struct *tsk)
1578−{
1579− return tsk->pid;
1580−}
1581−
1582−static inline pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1583−{
1584− return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
1585−}
1586−
1587−static inline pid_t task_pid_vnr(struct task_struct *tsk)
1588−{
1589− return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1590−}
1591−
1592−
1593−static inline pid_t task_tgid_nr(struct task_struct *tsk)
1594−{
1595− return tsk->tgid;
1596−}
1597−
1598−/**
1599− * pid_alive - check that a task structure is not stale
1600− * @p: Task structure to be checked.
1601− *
1602− * Test if a process is not yet dead (at most zombie state)
1603− * If pid_alive fails, then pointers within the task structure
1604− * can be stale and must not be dereferenced.
1605− *
1606− * Return: 1 if the process is alive. 0 otherwise.
1607− */
1608−static inline int pid_alive(const struct task_struct *p)
1609−{
1610− return p->thread_pid != NULL;
1611−}
1612−
1613−static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1614−{
1615− return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
1616−}
1617−
1618−static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1619−{
1620− return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1621−}
1622−
1623−
1624−static inline pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1625−{
1626− return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
1627−}
1628−
1629−static inline pid_t task_session_vnr(struct task_struct *tsk)
1630−{
1631− return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1632−}
1633−
1634−static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1635−{
1636− return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns);
1637−}
1638−
1639−static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1640−{
1641− return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
1642−}
1643−
1644−static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1645−{
1646− pid_t pid = 0;
1647−
1648− rcu_read_lock();
1649− if (pid_alive(tsk))
1650− pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1651− rcu_read_unlock();
1652−
1653− return pid;
1654−}
1655−
1656−static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1657−{
1658− return task_ppid_nr_ns(tsk, &init_pid_ns);
1659−}
1660−
1661−/* Obsolete, do not use: */
1662−static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1663−{
1664− return task_pgrp_nr_ns(tsk, &init_pid_ns);
1665−}
1666−
16671567 #define TASK_REPORT_IDLE (TASK_REPORT + 1)
16681568 #define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)
16691569
@@ -1707,20 +1607,6 @@ static inline char task_state_to_char(struct task_struct *tsk) · 37 unmodified lines
17071607 return task_index_to_char(task_state_index(tsk));
17081608 }
17091609
1710−/**
1711− * is_global_init - check if a task structure is init. Since init
1712− * is free to have sub-threads we need to check tgid.
1713− * @tsk: Task structure to be checked.
1714− *
1715− * Check if a task structure is the first user space task the kernel created.
1716− *
1717− * Return: 1 if the task structure is init. 0 otherwise.
1718− */
1719−static inline int is_global_init(struct task_struct *tsk)
1720−{
1721− return task_tgid_nr(tsk) == 1;
1722−}
1723−
17241610 extern struct pid *cad_pid;
17251611
17261612 /*
@@ -2170,15 +2056,6 @@ extern int __cond_resched_rwlock_write(rwlock_t *lock); · 443 unmodified lines
21702056 __cond_resched_rwlock_write(lock); \
21712057 })
21722058
2173−static inline void cond_resched_rcu(void)
2174−{
2175−#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
2176− rcu_read_unlock();
2177− cond_resched();
2178− rcu_read_lock();
2179−#endif
2180−}
2181−
21822059 #ifdef CONFIG_PREEMPT_DYNAMIC
21832060
21842061 extern bool preempt_model_none(void);
@@ -2220,37 +2097,6 @@ static inline bool preempt_model_preemptible(void) · 35 unmodified lines
22202097 return preempt_model_full() || preempt_model_rt();
22212098 }
22222099
2223−/*
2224− * Does a critical section need to be broken due to another
2225− * task waiting?: (technically does not depend on CONFIG_PREEMPTION,
2226− * but a general need for low latency)
2227− */
2228−static inline int spin_needbreak(spinlock_t *lock)
2229−{
2230−#ifdef CONFIG_PREEMPTION
2231− return spin_is_contended(lock);
2232−#else
2233− return 0;
2234−#endif
2235−}
2236−
2237−/*
2238− * Check if a rwlock is contended.
2239− * Returns non-zero if there is another task waiting on the rwlock.
2240− * Returns zero if the lock is not contended or the system / underlying
2241− * rwlock implementation does not support contention detection.
2242− * Technically does not depend on CONFIG_PREEMPTION, but a general need
2243− * for low latency.
2244− */
2245−static inline int rwlock_needbreak(rwlock_t *lock)
2246−{
2247−#ifdef CONFIG_PREEMPTION
2248− return rwlock_is_contended(lock);
2249−#else
2250− return 0;
2251−#endif
2252−}
2253−
22542100 static __always_inline bool need_resched(void)
22552101 {
22562102 return unlikely(tif_need_resched());
@@ -2285,6 +2131,8 @@ extern bool sched_task_on_rq(struct task_struct *p); · 28 unmodified lines
22852131 extern unsigned long get_wchan(struct task_struct *p);
22862132 extern struct task_struct *cpu_curr_snapshot(int cpu);
22872133
2134+#include <linux/spinlock.h>
2135+
22882136 /*
22892137 * In order to reduce various lock holder preemption latencies provide an
22902138 * interface to see if a vCPU is currently running or not.
@@ -2321,129 +2169,6 @@ static inline bool owner_on_cpu(struct task_struct *owner) · 30 unmodified lines
23212169 unsigned long sched_cpu_util(int cpu);
23222170 #endif /* CONFIG_SMP */
23232171
2324−#ifdef CONFIG_RSEQ
2325−
2326−/*
2327− * Map the event mask on the user-space ABI enum rseq_cs_flags
2328− * for direct mask checks.
2329− */
2330−enum rseq_event_mask_bits {
2331− RSEQ_EVENT_PREEMPT_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT,
2332− RSEQ_EVENT_SIGNAL_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT,
2333− RSEQ_EVENT_MIGRATE_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT,
2334−};
2335−
2336−enum rseq_event_mask {
2337− RSEQ_EVENT_PREEMPT = (1U << RSEQ_EVENT_PREEMPT_BIT),
2338− RSEQ_EVENT_SIGNAL = (1U << RSEQ_EVENT_SIGNAL_BIT),
2339− RSEQ_EVENT_MIGRATE = (1U << RSEQ_EVENT_MIGRATE_BIT),
2340−};
2341−
2342−static inline void rseq_set_notify_resume(struct task_struct *t)
2343−{
2344− if (t->rseq)
2345− set_tsk_thread_flag(t, TIF_NOTIFY_RESUME);
2346−}
2347−
2348−void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs);
2349−
2350−static inline void rseq_handle_notify_resume(struct ksignal *ksig,
2351− struct pt_regs *regs)
2352−{
2353− if (current->rseq)
2354− __rseq_handle_notify_resume(ksig, regs);
2355−}
2356−
2357−static inline void rseq_signal_deliver(struct ksignal *ksig,
2358− struct pt_regs *regs)
2359−{
2360− preempt_disable();
2361− __set_bit(RSEQ_EVENT_SIGNAL_BIT, &current->rseq_event_mask);
2362− preempt_enable();
2363− rseq_handle_notify_resume(ksig, regs);
2364−}
2365−
2366−/* rseq_preempt() requires preemption to be disabled. */
2367−static inline void rseq_preempt(struct task_struct *t)
2368−{
2369− __set_bit(RSEQ_EVENT_PREEMPT_BIT, &t->rseq_event_mask);
2370− rseq_set_notify_resume(t);
2371−}
2372−
2373−/* rseq_migrate() requires preemption to be disabled. */
2374−static inline void rseq_migrate(struct task_struct *t)
2375−{
2376− __set_bit(RSEQ_EVENT_MIGRATE_BIT, &t->rseq_event_mask);
2377− rseq_set_notify_resume(t);
2378−}
2379−
2380−/*
2381− * If parent process has a registered restartable sequences area, the
2382− * child inherits. Unregister rseq for a clone with CLONE_VM set.
2383− */
2384−static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
2385−{
2386− if (clone_flags & CLONE_VM) {
2387− t->rseq = NULL;
2388− t->rseq_len = 0;
2389− t->rseq_sig = 0;
2390− t->rseq_event_mask = 0;
2391− } else {
2392− t->rseq = current->rseq;
2393− t->rseq_len = current->rseq_len;
2394− t->rseq_sig = current->rseq_sig;
2395− t->rseq_event_mask = current->rseq_event_mask;
2396− }
2397−}
2398−
2399−static inline void rseq_execve(struct task_struct *t)
2400−{
2401− t->rseq = NULL;
2402− t->rseq_len = 0;
2403− t->rseq_sig = 0;
2404− t->rseq_event_mask = 0;
2405−}
2406−
2407−#else
2408−
2409−static inline void rseq_set_notify_resume(struct task_struct *t)
2410−{
2411−}
2412−static inline void rseq_handle_notify_resume(struct ksignal *ksig,
2413− struct pt_regs *regs)
2414−{
2415−}
2416−static inline void rseq_signal_deliver(struct ksignal *ksig,
2417− struct pt_regs *regs)
2418−{
2419−}
2420−static inline void rseq_preempt(struct task_struct *t)
2421−{
2422−}
2423−static inline void rseq_migrate(struct task_struct *t)
2424−{
2425−}
2426−static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
2427−{
2428−}
2429−static inline void rseq_execve(struct task_struct *t)
2430−{
2431−}
2432−
2433−#endif
2434−
2435−#ifdef CONFIG_DEBUG_RSEQ
2436−
2437−void rseq_syscall(struct pt_regs *regs);
2438−
2439−#else
2440−
2441−static inline void rseq_syscall(struct pt_regs *regs)
2442−{
2443−}
2444−
2445−#endif
2446−
24472172 #ifdef CONFIG_SCHED_CORE
24482173 extern void sched_core_free(struct task_struct *tsk);
24492174 extern void sched_core_fork(struct task_struct *p);
include/linux/sched/signal.h+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/sched/task.h>
1010 #include <linux/cred.h>
1111 #include <linux/refcount.h>
12+#include <linux/pid.h>
1213 #include <linux/posix-timers.h>
1314 #include <linux/mm_types.h>
1415 #include <asm/ptrace.h>
include/linux/sched/task.h+2−0
@@ -7,6 +7,8 @@ · 6 unmodified lines
77 * functionality:
88 */
99
10+#include <linux/rcupdate.h>
11+#include <linux/refcount.h>
1012 #include <linux/sched.h>
1113 #include <linux/uaccess.h>
1214
include/linux/sched/task_stack.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/sched.h>
1010 #include <linux/magic.h>
11+#include <linux/refcount.h>
1112
1213 #ifdef CONFIG_THREAD_INFO_IN_TASK
1314
include/linux/seccomp.h+3−21
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_SECCOMP_H
44
55 #include <uapi/linux/seccomp.h>
6+#include <linux/seccomp_types.h>
67
78 #define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
89 SECCOMP_FILTER_FLAG_LOG | \
@@ -21,25 +22,6 @@ · 12 unmodified lines
2122 #include <linux/atomic.h>
2223 #include <asm/seccomp.h>
2324
24−struct seccomp_filter;
25−/**
26− * struct seccomp - the state of a seccomp'ed process
27− *
28− * @mode: indicates one of the valid values above for controlled
29− * system calls available to a process.
30− * @filter_count: number of seccomp filters
31− * @filter: must always point to a valid seccomp-filter or NULL as it is
32− * accessed without locking during system call entry.
33− *
34− * @filter must only be accessed from the context of current as there
35− * is no read locking.
36− */
37−struct seccomp {
38− int mode;
39− atomic_t filter_count;
40− struct seccomp_filter *filter;
41−};
42−
4325 #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
4426 extern int __secure_computing(const struct seccomp_data *sd);
4527 static inline int secure_computing(void)
@@ -64,8 +46,6 @@ static inline int seccomp_mode(struct seccomp *s) · 18 unmodified lines
6446
6547 #include <linux/errno.h>
6648
67−struct seccomp { };
68−struct seccomp_filter { };
6949 struct seccomp_data;
7050
7151 #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
@@ -126,6 +106,8 @@ static inline long seccomp_get_metadata(struct task_struct *task, · 54 unmodified lines
126106
127107 #ifdef CONFIG_SECCOMP_CACHE_DEBUG
128108 struct seq_file;
109+struct pid_namespace;
110+struct pid;
129111
130112 int proc_pid_seccomp_cache(struct seq_file *m, struct pid_namespace *ns,
131113 struct pid *pid, struct task_struct *task);
include/linux/seccomp_types.h+35−0
@@ -0,0 +1,35 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_SECCOMP_TYPES_H
3+#define _LINUX_SECCOMP_TYPES_H
4+
5+#include <linux/types.h>
6+
7+#ifdef CONFIG_SECCOMP
8+
9+struct seccomp_filter;
10+/**
11+ * struct seccomp - the state of a seccomp'ed process
12+ *
13+ * @mode: indicates one of the valid values above for controlled
14+ * system calls available to a process.
15+ * @filter_count: number of seccomp filters
16+ * @filter: must always point to a valid seccomp-filter or NULL as it is
17+ * accessed without locking during system call entry.
18+ *
19+ * @filter must only be accessed from the context of current as there
20+ * is no read locking.
21+ */
22+struct seccomp {
23+ int mode;
24+ atomic_t filter_count;
25+ struct seccomp_filter *filter;
26+};
27+
28+#else
29+
30+struct seccomp { };
31+struct seccomp_filter { };
32+
33+#endif
34+
35+#endif /* _LINUX_SECCOMP_TYPES_H */
include/linux/sem.h+1−9
@@ -3,25 +3,17 @@ · 2 unmodified lines
33 #define _LINUX_SEM_H
44
55 #include <uapi/linux/sem.h>
6+#include <linux/sem_types.h>
67
78 struct task_struct;
8−struct sem_undo_list;
99
1010 #ifdef CONFIG_SYSVIPC
1111
12−struct sysv_sem {
13− struct sem_undo_list *undo_list;
14−};
15−
1612 extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
1713 extern void exit_sem(struct task_struct *tsk);
1814
1915 #else
2016
21−struct sysv_sem {
22− /* empty */
23−};
24−
2517 static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
2618 {
2719 return 0;
include/linux/sem_types.h+13−0
@@ -0,0 +1,13 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_SEM_TYPES_H
3+#define _LINUX_SEM_TYPES_H
4+
5+struct sem_undo_list;
6+
7+struct sysv_sem {
8+#ifdef CONFIG_SYSVIPC
9+ struct sem_undo_list *undo_list;
10+#endif
11+};
12+
13+#endif /* _LINUX_SEM_TYPES_H */
include/linux/seqlock.h+2−77
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/lockdep.h>
1919 #include <linux/mutex.h>
2020 #include <linux/preempt.h>
21+#include <linux/seqlock_types.h>
2122 #include <linux/spinlock.h>
2223
2324 #include <asm/processor.h>
@@ -37,37 +38,6 @@ · 13 unmodified lines
3738 */
3839 #define KCSAN_SEQLOCK_REGION_MAX 1000
3940
40−/*
41− * Sequence counters (seqcount_t)
42− *
43− * This is the raw counting mechanism, without any writer protection.
44− *
45− * Write side critical sections must be serialized and non-preemptible.
46− *
47− * If readers can be invoked from hardirq or softirq contexts,
48− * interrupts or bottom halves must also be respectively disabled before
49− * entering the write section.
50− *
51− * This mechanism can't be used if the protected data contains pointers,
52− * as the writer can invalidate a pointer that a reader is following.
53− *
54− * If the write serialization mechanism is one of the common kernel
55− * locking primitives, use a sequence counter with associated lock
56− * (seqcount_LOCKNAME_t) instead.
57− *
58− * If it's desired to automatically handle the sequence counter writer
59− * serialization and non-preemptibility requirements, use a sequential
60− * lock (seqlock_t) instead.
61− *
62− * See Documentation/locking/seqlock.rst
63− */
64−typedef struct seqcount {
65− unsigned sequence;
66−#ifdef CONFIG_DEBUG_LOCK_ALLOC
67− struct lockdep_map dep_map;
68−#endif
69−} seqcount_t;
70−
7141 static inline void __seqcount_init(seqcount_t *s, const char *name,
7242 struct lock_class_key *key)
7343 {
@@ -131,28 +101,6 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 57 unmodified lines
131101 * See Documentation/locking/seqlock.rst
132102 */
133103
134−/*
135− * For PREEMPT_RT, seqcount_LOCKNAME_t write side critical sections cannot
136− * disable preemption. It can lead to higher latencies, and the write side
137− * sections will not be able to acquire locks which become sleeping locks
138− * (e.g. spinlock_t).
139− *
140− * To remain preemptible while avoiding a possible livelock caused by the
141− * reader preempting the writer, use a different technique: let the reader
142− * detect if a seqcount_LOCKNAME_t writer is in progress. If that is the
143− * case, acquire then release the associated LOCKNAME writer serialization
144− * lock. This will allow any possibly-preempted writer to make progress
145− * until the end of its writer serialization lock critical section.
146− *
147− * This lock-unlock technique must be implemented for all of PREEMPT_RT
148− * sleeping locks. See Documentation/locking/locktypes.rst
149− */
150−#if defined(CONFIG_LOCKDEP) || defined(CONFIG_PREEMPT_RT)
151−#define __SEQ_LOCK(expr) expr
152−#else
153−#define __SEQ_LOCK(expr)
154−#endif
155−
156104 /*
157105 * typedef seqcount_LOCKNAME_t - sequence counter with LOCKNAME associated
158106 * @seqcount: The real sequence counter
@@ -194,11 +142,6 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 35 unmodified lines
194142 * @lockbase: prefix for associated lock/unlock
195143 */
196144 #define SEQCOUNT_LOCKNAME(lockname, locktype, preemptible, lockbase) \
197−typedef struct seqcount_##lockname { \
198− seqcount_t seqcount; \
199− __SEQ_LOCK(locktype *lock); \
200−} seqcount_##lockname##_t; \
201− \
202145 static __always_inline seqcount_t * \
203146 __seqprop_##lockname##_ptr(seqcount_##lockname##_t *s) \
204147 { \
@@ -284,6 +227,7 @@ SEQCOUNT_LOCKNAME(raw_spinlock, raw_spinlock_t, false, raw_spin) · 79 unmodified lines
284227 SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, spin)
285228 SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, read)
286229 SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
230+#undef SEQCOUNT_LOCKNAME
287231
288232 /*
289233 * SEQCNT_LOCKNAME_ZERO - static initializer for seqcount_LOCKNAME_t
@@ -794,25 +738,6 @@ static inline void raw_write_seqcount_latch(seqcount_latch_t *s) · 504 unmodified lines
794738 smp_wmb(); /* increment "sequence" before following stores */
795739 }
796740
797−/*
798− * Sequential locks (seqlock_t)
799− *
800− * Sequence counters with an embedded spinlock for writer serialization
801− * and non-preemptibility.
802− *
803− * For more info, see:
804− * - Comments on top of seqcount_t
805− * - Documentation/locking/seqlock.rst
806− */
807−typedef struct {
808− /*
809− * Make sure that readers don't starve writers on PREEMPT_RT: use
810− * seqcount_spinlock_t instead of seqcount_t. Check __SEQ_LOCK().
811− */
812− seqcount_spinlock_t seqcount;
813− spinlock_t lock;
814−} seqlock_t;
815−
816741 #define __SEQLOCK_UNLOCKED(lockname) \
817742 { \
818743 .seqcount = SEQCNT_SPINLOCK_ZERO(lockname, &(lockname).lock), \
include/linux/seqlock_types.h+93−0
@@ -0,0 +1,93 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __LINUX_SEQLOCK_TYPES_H
3+#define __LINUX_SEQLOCK_TYPES_H
4+
5+#include <linux/lockdep_types.h>
6+#include <linux/mutex_types.h>
7+#include <linux/spinlock_types.h>
8+
9+/*
10+ * Sequence counters (seqcount_t)
11+ *
12+ * This is the raw counting mechanism, without any writer protection.
13+ *
14+ * Write side critical sections must be serialized and non-preemptible.
15+ *
16+ * If readers can be invoked from hardirq or softirq contexts,
17+ * interrupts or bottom halves must also be respectively disabled before
18+ * entering the write section.
19+ *
20+ * This mechanism can't be used if the protected data contains pointers,
21+ * as the writer can invalidate a pointer that a reader is following.
22+ *
23+ * If the write serialization mechanism is one of the common kernel
24+ * locking primitives, use a sequence counter with associated lock
25+ * (seqcount_LOCKNAME_t) instead.
26+ *
27+ * If it's desired to automatically handle the sequence counter writer
28+ * serialization and non-preemptibility requirements, use a sequential
29+ * lock (seqlock_t) instead.
30+ *
31+ * See Documentation/locking/seqlock.rst
32+ */
33+typedef struct seqcount {
34+ unsigned sequence;
35+#ifdef CONFIG_DEBUG_LOCK_ALLOC
36+ struct lockdep_map dep_map;
37+#endif
38+} seqcount_t;
39+
40+/*
41+ * For PREEMPT_RT, seqcount_LOCKNAME_t write side critical sections cannot
42+ * disable preemption. It can lead to higher latencies, and the write side
43+ * sections will not be able to acquire locks which become sleeping locks
44+ * (e.g. spinlock_t).
45+ *
46+ * To remain preemptible while avoiding a possible livelock caused by the
47+ * reader preempting the writer, use a different technique: let the reader
48+ * detect if a seqcount_LOCKNAME_t writer is in progress. If that is the
49+ * case, acquire then release the associated LOCKNAME writer serialization
50+ * lock. This will allow any possibly-preempted writer to make progress
51+ * until the end of its writer serialization lock critical section.
52+ *
53+ * This lock-unlock technique must be implemented for all of PREEMPT_RT
54+ * sleeping locks. See Documentation/locking/locktypes.rst
55+ */
56+#if defined(CONFIG_LOCKDEP) || defined(CONFIG_PREEMPT_RT)
57+#define __SEQ_LOCK(expr) expr
58+#else
59+#define __SEQ_LOCK(expr)
60+#endif
61+
62+#define SEQCOUNT_LOCKNAME(lockname, locktype, preemptible, lockbase) \
63+typedef struct seqcount_##lockname { \
64+ seqcount_t seqcount; \
65+ __SEQ_LOCK(locktype *lock); \
66+} seqcount_##lockname##_t;
67+
68+SEQCOUNT_LOCKNAME(raw_spinlock, raw_spinlock_t, false, raw_spin)
69+SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, spin)
70+SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, read)
71+SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
72+#undef SEQCOUNT_LOCKNAME
73+
74+/*
75+ * Sequential locks (seqlock_t)
76+ *
77+ * Sequence counters with an embedded spinlock for writer serialization
78+ * and non-preemptibility.
79+ *
80+ * For more info, see:
81+ * - Comments on top of seqcount_t
82+ * - Documentation/locking/seqlock.rst
83+ */
84+typedef struct {
85+ /*
86+ * Make sure that readers don't starve writers on PREEMPT_RT: use
87+ * seqcount_spinlock_t instead of seqcount_t. Check __SEQ_LOCK().
88+ */
89+ seqcount_spinlock_t seqcount;
90+ spinlock_t lock;
91+} seqlock_t;
92+
93+#endif /* __LINUX_SEQLOCK_TYPES_H */
include/linux/shm.h+2−2
@@ -2,12 +2,12 @@ · 1 unmodified line
22 #ifndef _LINUX_SHM_H_
33 #define _LINUX_SHM_H_
44
5−#include <linux/list.h>
5+#include <linux/types.h>
66 #include <asm/page.h>
7−#include <uapi/linux/shm.h>
87 #include <asm/shmparam.h>
98
109 struct file;
10+struct task_struct;
1111
1212 #ifdef CONFIG_SYSVIPC
1313 struct sysv_shm {
include/linux/signal.h+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_SIGNAL_H
44
55 #include <linux/bug.h>
6+#include <linux/list.h>
67 #include <linux/signal_types.h>
78 #include <linux/string.h>
89
include/linux/signal_types.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 * Basic signal handling related data type definitions:
77 */
88
9−#include <linux/list.h>
9+#include <linux/types.h>
1010 #include <uapi/linux/signal.h>
1111
1212 typedef struct kernel_siginfo {
include/linux/spinlock.h+31−0
@@ -449,6 +449,37 @@ static __always_inline int spin_is_contended(spinlock_t *lock) · 448 unmodified lines
449449 return raw_spin_is_contended(&lock->rlock);
450450 }
451451
452+/*
453+ * Does a critical section need to be broken due to another
454+ * task waiting?: (technically does not depend on CONFIG_PREEMPTION,
455+ * but a general need for low latency)
456+ */
457+static inline int spin_needbreak(spinlock_t *lock)
458+{
459+#ifdef CONFIG_PREEMPTION
460+ return spin_is_contended(lock);
461+#else
462+ return 0;
463+#endif
464+}
465+
466+/*
467+ * Check if a rwlock is contended.
468+ * Returns non-zero if there is another task waiting on the rwlock.
469+ * Returns zero if the lock is not contended or the system / underlying
470+ * rwlock implementation does not support contention detection.
471+ * Technically does not depend on CONFIG_PREEMPTION, but a general need
472+ * for low latency.
473+ */
474+static inline int rwlock_needbreak(rwlock_t *lock)
475+{
476+#ifdef CONFIG_PREEMPTION
477+ return rwlock_is_contended(lock);
478+#else
479+ return 0;
480+#endif
481+}
482+
452483 #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
453484
454485 #else /* !CONFIG_PREEMPT_RT */
include/linux/syscall_user_dispatch.h+1−8
@@ -6,16 +6,10 @@ · 5 unmodified lines
66 #define _SYSCALL_USER_DISPATCH_H
77
88 #include <linux/thread_info.h>
9+#include <linux/syscall_user_dispatch_types.h>
910
1011 #ifdef CONFIG_GENERIC_ENTRY
1112
12−struct syscall_user_dispatch {
13− char __user *selector;
14− unsigned long offset;
15− unsigned long len;
16− bool on_dispatch;
17−};
18−
1913 int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
2014 unsigned long len, char __user *selector);
2115
@@ -29,7 +23,6 @@ int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long siz · 7 unmodified lines
2923 void __user *data);
3024
3125 #else
32−struct syscall_user_dispatch {};
3326
3427 static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
3528 unsigned long len, char __user *selector)
include/linux/syscall_user_dispatch_types.h+22−0
@@ -0,0 +1,22 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _SYSCALL_USER_DISPATCH_TYPES_H
3+#define _SYSCALL_USER_DISPATCH_TYPES_H
4+
5+#include <linux/types.h>
6+
7+#ifdef CONFIG_GENERIC_ENTRY
8+
9+struct syscall_user_dispatch {
10+ char __user *selector;
11+ unsigned long offset;
12+ unsigned long len;
13+ bool on_dispatch;
14+};
15+
16+#else
17+
18+struct syscall_user_dispatch {};
19+
20+#endif
21+
22+#endif /* _SYSCALL_USER_DISPATCH_TYPES_H */
include/linux/time_namespace.h+3−0
@@ -7,10 +7,13 @@ · 6 unmodified lines
77 #include <linux/nsproxy.h>
88 #include <linux/ns_common.h>
99 #include <linux/err.h>
10+#include <linux/time64.h>
1011
1112 struct user_namespace;
1213 extern struct user_namespace init_user_ns;
1314
15+struct vm_area_struct;
16+
1417 struct timens_offsets {
1518 struct timespec64 monotonic;
1619 struct timespec64 boottime;
include/linux/timekeeping.h+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 #include <linux/errno.h>
66 #include <linux/clocksource_ids.h>
7+#include <linux/ktime.h>
78
89 /* Included from linux/ktime.h */
910
include/linux/timer.h+1−15
@@ -7,21 +7,7 @@ · 6 unmodified lines
77 #include <linux/stddef.h>
88 #include <linux/debugobjects.h>
99 #include <linux/stringify.h>
10−
11−struct timer_list {
12− /*
13− * All fields that change during normal runtime grouped to the
14− * same cacheline
15− */
16− struct hlist_node entry;
17− unsigned long expires;
18− void (*function)(struct timer_list *);
19− u32 flags;
20−
21−#ifdef CONFIG_LOCKDEP
22− struct lockdep_map lockdep_map;
23−#endif
24−};
10+#include <linux/timer_types.h>
2511
2612 #ifdef CONFIG_LOCKDEP
2713 /*
include/linux/timer_types.h+23−0
@@ -0,0 +1,23 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_TIMER_TYPES_H
3+#define _LINUX_TIMER_TYPES_H
4+
5+#include <linux/lockdep_types.h>
6+#include <linux/types.h>
7+
8+struct timer_list {
9+ /*
10+ * All fields that change during normal runtime grouped to the
11+ * same cacheline
12+ */
13+ struct hlist_node entry;
14+ unsigned long expires;
15+ void (*function)(struct timer_list *);
16+ u32 flags;
17+
18+#ifdef CONFIG_LOCKDEP
19+ struct lockdep_map lockdep_map;
20+#endif
21+};
22+
23+#endif /* _LINUX_TIMER_TYPES_H */
include/linux/timerqueue.h+1−12
@@ -3,18 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_TIMERQUEUE_H
44
55 #include <linux/rbtree.h>
6−#include <linux/ktime.h>
7−
8−
9−struct timerqueue_node {
10− struct rb_node node;
11− ktime_t expires;
12−};
13−
14−struct timerqueue_head {
15− struct rb_root_cached rb_root;
16−};
17−
6+#include <linux/timerqueue_types.h>
187
198 extern bool timerqueue_add(struct timerqueue_head *head,
209 struct timerqueue_node *node);
include/linux/timerqueue_types.h+17−0
@@ -0,0 +1,17 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_TIMERQUEUE_TYPES_H
3+#define _LINUX_TIMERQUEUE_TYPES_H
4+
5+#include <linux/rbtree_types.h>
6+#include <linux/types.h>
7+
8+struct timerqueue_node {
9+ struct rb_node node;
10+ ktime_t expires;
11+};
12+
13+struct timerqueue_head {
14+ struct rb_root_cached rb_root;
15+};
16+
17+#endif /* _LINUX_TIMERQUEUE_TYPES_H */
include/linux/torture.h+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/debugobjects.h>
2222 #include <linux/bug.h>
2323 #include <linux/compiler.h>
24+#include <linux/hrtimer.h>
2425
2526 /* Definitions for a non-string torture-test module parameter. */
2627 #define torture_param(type, name, init, msg) \
include/linux/types.h+3−0
@@ -120,6 +120,9 @@ typedef s64 int64_t; · 119 unmodified lines
120120 #define aligned_be64 __aligned_be64
121121 #define aligned_le64 __aligned_le64
122122
123+/* Nanosecond scalar representation for kernel time values */
124+typedef s64 ktime_t;
125+
123126 /**
124127 * The type used for indexing onto a disc or disc partition.
125128 *
include/linux/uidgid.h+1−10
@@ -12,22 +12,13 @@ · 11 unmodified lines
1212 * to detect when we overlook these differences.
1313 *
1414 */
15−#include <linux/types.h>
15+#include <linux/uidgid_types.h>
1616 #include <linux/highuid.h>
1717
1818 struct user_namespace;
1919 extern struct user_namespace init_user_ns;
2020 struct uid_gid_map;
2121
22−typedef struct {
23− uid_t val;
24−} kuid_t;
25−
26−
27−typedef struct {
28− gid_t val;
29−} kgid_t;
30−
3122 #define KUIDT_INIT(value) (kuid_t){ value }
3223 #define KGIDT_INIT(value) (kgid_t){ value }
3324
include/linux/uidgid_types.h+15−0
@@ -0,0 +1,15 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_UIDGID_TYPES_H
3+#define _LINUX_UIDGID_TYPES_H
4+
5+#include <linux/types.h>
6+
7+typedef struct {
8+ uid_t val;
9+} kuid_t;
10+
11+typedef struct {
12+ gid_t val;
13+} kgid_t;
14+
15+#endif /* _LINUX_UIDGID_TYPES_H */
include/linux/wait.h+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #include <linux/spinlock.h>
1010
1111 #include <asm/current.h>
12−#include <uapi/linux/wait.h>
1312
1413 typedef struct wait_queue_entry wait_queue_entry_t;
1514
include/linux/workqueue.h+1−15
@@ -14,12 +14,7 @@ · 13 unmodified lines
1414 #include <linux/atomic.h>
1515 #include <linux/cpumask.h>
1616 #include <linux/rcupdate.h>
17−
18−struct workqueue_struct;
19−
20−struct work_struct;
21−typedef void (*work_func_t)(struct work_struct *work);
22−void delayed_work_timer_fn(struct timer_list *t);
17+#include <linux/workqueue_types.h>
2318
2419 /*
2520 * The first word is the work queue pointer and the flags rolled into
@@ -95,15 +90,6 @@ enum { · 69 unmodified lines
9590 #define WORK_STRUCT_FLAG_MASK ((1ul << WORK_STRUCT_FLAG_BITS) - 1)
9691 #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
9792
98−struct work_struct {
99− atomic_long_t data;
100− struct list_head entry;
101− work_func_t func;
102−#ifdef CONFIG_LOCKDEP
103− struct lockdep_map lockdep_map;
104−#endif
105−};
106−
10793 #define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL)
10894 #define WORK_DATA_STATIC_INIT() \
10995 ATOMIC_LONG_INIT((unsigned long)(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC))
include/linux/workqueue_types.h+25−0
@@ -0,0 +1,25 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_WORKQUEUE_TYPES_H
3+#define _LINUX_WORKQUEUE_TYPES_H
4+
5+#include <linux/atomic.h>
6+#include <linux/lockdep_types.h>
7+#include <linux/timer_types.h>
8+#include <linux/types.h>
9+
10+struct workqueue_struct;
11+
12+struct work_struct;
13+typedef void (*work_func_t)(struct work_struct *work);
14+void delayed_work_timer_fn(struct timer_list *t);
15+
16+struct work_struct {
17+ atomic_long_t data;
18+ struct list_head entry;
19+ work_func_t func;
20+#ifdef CONFIG_LOCKDEP
21+ struct lockdep_map lockdep_map;
22+#endif
23+};
24+
25+#endif /* _LINUX_WORKQUEUE_TYPES_H */
include/uapi/linux/resource.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _UAPI_LINUX_RESOURCE_H
33 #define _UAPI_LINUX_RESOURCE_H
44
5−#include <linux/time.h>
5+#include <linux/time_types.h>
66 #include <linux/types.h>
77
88 /*
init/init_task.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/audit.h>
1313 #include <linux/numa.h>
1414 #include <linux/scs.h>
15+#include <linux/plist.h>
1516
1617 #include <linux/uaccess.h>
1718
ipc/shm.c+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/mm.h>
3030 #include <linux/hugetlb.h>
3131 #include <linux/shm.h>
32+#include <uapi/linux/shm.h>
3233 #include <linux/init.h>
3334 #include <linux/file.h>
3435 #include <linux/mman.h>
ipc/util.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/unistd.h>
1515 #include <linux/err.h>
1616 #include <linux/ipc_namespace.h>
17+#include <linux/pid.h>
1718
1819 /*
1920 * The IPC ID contains 2 separate numbers - index and sequence number.
kernel/Makefile+1−0
@@ -114,6 +114,7 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o · 113 unmodified lines
114114 obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
115115 obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
116116 obj-$(CONFIG_CFI_CLANG) += cfi.o
117+obj-$(CONFIG_NUMA) += numa.o
117118
118119 obj-$(CONFIG_PERF_EVENTS) += events/
119120
kernel/async.c+3−2
@@ -46,11 +46,12 @@ asynchronous and synchronous parts of the kernel. · 45 unmodified lines
4646
4747 #include <linux/async.h>
4848 #include <linux/atomic.h>
49−#include <linux/ktime.h>
5049 #include <linux/export.h>
51−#include <linux/wait.h>
50+#include <linux/ktime.h>
51+#include <linux/pid.h>
5252 #include <linux/sched.h>
5353 #include <linux/slab.h>
54+#include <linux/wait.h>
5455 #include <linux/workqueue.h>
5556
5657 #include "workqueue_internal.h"
kernel/bpf/hashtab.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/jhash.h>
88 #include <linux/filter.h>
99 #include <linux/rculist_nulls.h>
10+#include <linux/rcupdate_wait.h>
1011 #include <linux/random.h>
1112 #include <uapi/linux/btf.h>
1213 #include <linux/rcupdate_trace.h>
kernel/exit.c+3−1
@@ -69,8 +69,10 @@ · 68 unmodified lines
6969 #include <linux/rethook.h>
7070 #include <linux/sysfs.h>
7171 #include <linux/user_events.h>
72−
7372 #include <linux/uaccess.h>
73+
74+#include <uapi/linux/wait.h>
75+
7476 #include <asm/unistd.h>
7577 #include <asm/mmu_context.h>
7678
kernel/fork.c+2−0
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include <linux/seccomp.h>
5454 #include <linux/swap.h>
5555 #include <linux/syscalls.h>
56+#include <linux/syscall_user_dispatch.h>
5657 #include <linux/jiffies.h>
5758 #include <linux/futex.h>
5859 #include <linux/compat.h>
@@ -99,6 +100,7 @@ · 40 unmodified lines
99100 #include <linux/stackprotector.h>
100101 #include <linux/user_events.h>
101102 #include <linux/iommu.h>
103+#include <linux/rseq.h>
102104
103105 #include <asm/pgalloc.h>
104106 #include <linux/uaccess.h>
kernel/futex/core.c+1−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/compat.h>
3535 #include <linux/jhash.h>
3636 #include <linux/pagemap.h>
37+#include <linux/plist.h>
3738 #include <linux/memblock.h>
3839 #include <linux/fault-inject.h>
3940 #include <linux/slab.h>
kernel/futex/requeue.c+1−0
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22
3+#include <linux/plist.h>
34 #include <linux/sched/signal.h>
45
56 #include "futex.h"
kernel/futex/waitwake.c+1−0
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22
3+#include <linux/plist.h>
34 #include <linux/sched/task.h>
45 #include <linux/sched/signal.h>
56 #include <linux/freezer.h>
kernel/locking/spinlock_debug.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/debug_locks.h>
1313 #include <linux/delay.h>
1414 #include <linux/export.h>
15+#include <linux/pid.h>
1516
1617 void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
1718 struct lock_class_key *key, short inner)
kernel/numa.c+26−0
@@ -0,0 +1,26 @@
1+// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+#include <linux/printk.h>
4+#include <linux/numa.h>
5+
6+/* Stub functions: */
7+
8+#ifndef memory_add_physaddr_to_nid
9+int memory_add_physaddr_to_nid(u64 start)
10+{
11+ pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
12+ start);
13+ return 0;
14+}
15+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
16+#endif
17+
18+#ifndef phys_to_target_node
19+int phys_to_target_node(u64 start)
20+{
21+ pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
22+ start);
23+ return 0;
24+}
25+EXPORT_SYMBOL_GPL(phys_to_target_node);
26+#endif
kernel/pid_namespace.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/sched/task.h>
2424 #include <linux/sched/signal.h>
2525 #include <linux/idr.h>
26+#include <uapi/linux/wait.h>
2627 #include "pid_sysctl.h"
2728
2829 static DEFINE_MUTEX(pid_caches_mutex);
kernel/sched/core.c+1−0
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757 #include <linux/profile.h>
5858 #include <linux/psi.h>
5959 #include <linux/rcuwait_api.h>
60+#include <linux/rseq.h>
6061 #include <linux/sched/wake_q.h>
6162 #include <linux/scs.h>
6263 #include <linux/slab.h>
lib/test_rhashtable.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/kthread.h>
1717 #include <linux/module.h>
1818 #include <linux/rcupdate.h>
19+#include <linux/rcupdate_wait.h>
1920 #include <linux/rhashtable.h>
2021 #include <linux/slab.h>
2122 #include <linux/sched.h>
mm/filemap.c+1−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include <linux/migrate.h>
4646 #include <linux/pipe_fs_i.h>
4747 #include <linux/splice.h>
48+#include <linux/rcupdate_wait.h>
4849 #include <asm/pgalloc.h>
4950 #include <asm/tlbflush.h>
5051 #include "internal.h"
mm/khugepaged.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/userfaultfd_k.h>
1818 #include <linux/page_idle.h>
1919 #include <linux/page_table_check.h>
20+#include <linux/rcupdate_wait.h>
2021 #include <linux/swapops.h>
2122 #include <linux/shmem_fs.h>
2223 #include <linux/ksm.h>
mm/shmem.c+1−0
@@ -79,6 +79,7 @@ static struct vfsmount *shm_mnt __ro_after_init; · 78 unmodified lines
7979 #include <linux/rmap.h>
8080 #include <linux/uuid.h>
8181 #include <linux/quotaops.h>
82+#include <linux/rcupdate_wait.h>
8283
8384 #include <linux/uaccess.h>
8485
mm/swapfile.c+1−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
4242 #include <linux/completion.h>
4343 #include <linux/suspend.h>
4444 #include <linux/zswap.h>
45+#include <linux/plist.h>
4546
4647 #include <asm/tlbflush.h>
4748 #include <linux/swapops.h>
net/ipv4/fib_trie.c+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #include <linux/if_arp.h>
5353 #include <linux/proc_fs.h>
5454 #include <linux/rcupdate.h>
55+#include <linux/rcupdate_wait.h>
5556 #include <linux/skbuff.h>
5657 #include <linux/netlink.h>
5758 #include <linux/init.h>
net/netfilter/ipset/ip_set_bitmap_gen.h+2−0
@@ -4,6 +4,8 @@ · 3 unmodified lines
44 #ifndef __IP_SET_BITMAP_IP_GEN_H
55 #define __IP_SET_BITMAP_IP_GEN_H
66
7+#include <linux/rcupdate_wait.h>
8+
79 #define mtype_do_test IPSET_TOKEN(MTYPE, _do_test)
810 #define mtype_gc_test IPSET_TOKEN(MTYPE, _gc_test)
911 #define mtype_is_filled IPSET_TOKEN(MTYPE, _is_filled)
net/netfilter/ipset/ip_set_hash_gen.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #define _IP_SET_HASH_GEN_H
66
77 #include <linux/rcupdate.h>
8+#include <linux/rcupdate_wait.h>
89 #include <linux/jhash.h>
910 #include <linux/types.h>
1011 #include <linux/netfilter/nfnetlink.h>
net/netfilter/ipvs/ip_vs_conn.c+1−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include <linux/seq_file.h>
3232 #include <linux/jhash.h>
3333 #include <linux/random.h>
34+#include <linux/rcupdate_wait.h>
3435
3536 #include <net/net_namespace.h>
3637 #include <net/ip_vs.h>
net/netfilter/ipvs/ip_vs_est.c+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/interrupt.h>
2222 #include <linux/sysctl.h>
2323 #include <linux/list.h>
24+#include <linux/rcupdate_wait.h>
2425
2526 #include <net/ip_vs.h>
2627
security/selinux/hooks.c+1−0
@@ -85,6 +85,7 @@ · 84 unmodified lines
8585 #include <linux/export.h>
8686 #include <linux/msg.h>
8787 #include <linux/shm.h>
88+#include <uapi/linux/shm.h>
8889 #include <linux/bpf.h>
8990 #include <linux/kernfs.h>
9091 #include <linux/stringhash.h> /* for hashlen_string() */
security/smack/smack_lsm.c+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include <linux/personality.h>
3838 #include <linux/msg.h>
3939 #include <linux/shm.h>
40+#include <uapi/linux/shm.h>
4041 #include <linux/binfmts.h>
4142 #include <linux/parser.h>
4243 #include <linux/fs_context.h>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t