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
13#define __BP_HARDEN_HYP_VECS_SZ ((BP_HARDEN_EL2_SLOTS - 1) * SZ_2K)13#define __BP_HARDEN_HYP_VECS_SZ ((BP_HARDEN_EL2_SLOTS - 1) * SZ_2K)
14 14
15#ifndef __ASSEMBLY__15#ifndef __ASSEMBLY__
16 16#include <linux/smp.h>
17#include <linux/percpu.h>17#include <asm/percpu.h>
18 18
19#include <asm/cpufeature.h>19#include <asm/cpufeature.h>
20#include <asm/virt.h>20#include <asm/virt.h>
arch/arm64/kernel/ptrace.c+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
28#include <linux/hw_breakpoint.h>28#include <linux/hw_breakpoint.h>
29#include <linux/regset.h>29#include <linux/regset.h>
30#include <linux/elf.h>30#include <linux/elf.h>
31#include <linux/rseq.h>
31 32
32#include <asm/compat.h>33#include <asm/compat.h>
33#include <asm/cpufeature.h>34#include <asm/cpufeature.h>
arch/loongarch/kernel/signal.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/context_tracking.h>15#include <linux/context_tracking.h>
16#include <linux/entry-common.h>16#include <linux/entry-common.h>
17#include <linux/irqflags.h>17#include <linux/irqflags.h>
18#include <linux/rseq.h>
18#include <linux/sched.h>19#include <linux/sched.h>
19#include <linux/mm.h>20#include <linux/mm.h>
20#include <linux/personality.h>21#include <linux/personality.h>
arch/m68k/include/asm/processor.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#ifndef __ASM_M68K_PROCESSOR_H8#ifndef __ASM_M68K_PROCESSOR_H
9#define __ASM_M68K_PROCESSOR_H9#define __ASM_M68K_PROCESSOR_H
10 10
11#include <linux/preempt.h>
11#include <linux/thread_info.h>12#include <linux/thread_info.h>
12#include <asm/fpu.h>13#include <asm/fpu.h>
13#include <asm/ptrace.h>14#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
336}336}
337 337
338#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG338#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
339struct vm_area_struct;
339static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,340static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
340 unsigned long address, pte_t *ptep)341 unsigned long address, pte_t *ptep)
341{342{
arch/parisc/mm/init.c+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
33#include <asm/msgbuf.h>33#include <asm/msgbuf.h>
34#include <asm/sparsemem.h>34#include <asm/sparsemem.h>
35#include <asm/asm-offsets.h>35#include <asm/asm-offsets.h>
36#include <asm/shmbuf.h>
36 37
37extern int data_start;38extern int data_start;
38extern void parisc_kernel_start(void); /* Kernel entry point in head.S */39extern 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
3#include <linux/context_tracking.h>3#include <linux/context_tracking.h>
4#include <linux/err.h>4#include <linux/err.h>
5#include <linux/compat.h>5#include <linux/compat.h>
6#include <linux/rseq.h>
6#include <linux/sched/debug.h> /* for show_regs */7#include <linux/sched/debug.h> /* for show_regs */
7 8
8#include <asm/kup.h>9#include <asm/kup.h>
arch/powerpc/kvm/book3s_64_vio.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
20#include <linux/iommu.h>20#include <linux/iommu.h>
21#include <linux/file.h>21#include <linux/file.h>
22#include <linux/mm.h>22#include <linux/mm.h>
23#include <linux/rcupdate_wait.h>
23 24
24#include <asm/kvm_ppc.h>25#include <asm/kvm_ppc.h>
25#include <asm/kvm_book3s.h>26#include <asm/kvm_book3s.h>
arch/s390/kernel/signal.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12 12
13#include <linux/sched.h>13#include <linux/sched.h>
14#include <linux/sched/task_stack.h>14#include <linux/sched/task_stack.h>
15#include <linux/rseq.h>
15#include <linux/mm.h>16#include <linux/mm.h>
16#include <linux/smp.h>17#include <linux/smp.h>
17#include <linux/kernel.h>18#include <linux/kernel.h>
arch/x86/include/asm/current.h+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
2#ifndef _ASM_X86_CURRENT_H2#ifndef _ASM_X86_CURRENT_H
3#define _ASM_X86_CURRENT_H3#define _ASM_X86_CURRENT_H
4 4
5#include <linux/build_bug.h>
5#include <linux/compiler.h>6#include <linux/compiler.h>
6 7
7#ifndef __ASSEMBLY__8#ifndef __ASSEMBLY__
arch/x86/include/asm/debugreg.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5#include <linux/bug.h>5#include <linux/bug.h>
6#include <linux/percpu.h>6#include <linux/percpu.h>
7#include <uapi/asm/debugreg.h>7#include <uapi/asm/debugreg.h>
8#include <asm/cpufeature.h>
8 9
9DECLARE_PER_CPU(unsigned long, cpu_dr7);10DECLARE_PER_CPU(unsigned long, cpu_dr7);
10 11
arch/x86/include/asm/fpu/types.h+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
5#ifndef _ASM_X86_FPU_H5#ifndef _ASM_X86_FPU_H
6#define _ASM_X86_FPU_H6#define _ASM_X86_FPU_H
7 7
8#include <asm/page_types.h>
9
8/*10/*
9 * The legacy x87 FPU state format, as saved by FSAVE and11 * The legacy x87 FPU state format, as saved by FSAVE and
10 * restored by the FRSTOR instructions:12 * restored by the FRSTOR instructions:
arch/x86/include/asm/paravirt.h+4−0
@@ -6,6 +6,10 @@ · 5 unmodified lines
6 6
7#include <asm/paravirt_types.h>7#include <asm/paravirt_types.h>
8 8
9#ifndef __ASSEMBLY__
10struct mm_struct;
11#endif
12
9#ifdef CONFIG_PARAVIRT13#ifdef CONFIG_PARAVIRT
10#include <asm/pgtable_types.h>14#include <asm/pgtable_types.h>
11#include <asm/asm.h>15#include <asm/asm.h>
arch/x86/include/asm/paravirt_types.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5#ifdef CONFIG_PARAVIRT5#ifdef CONFIG_PARAVIRT
6 6
7#ifndef __ASSEMBLY__7#ifndef __ASSEMBLY__
8#include <linux/types.h>
8 9
9#include <asm/desc_defs.h>10#include <asm/desc_defs.h>
10#include <asm/pgtable_types.h>11#include <asm/pgtable_types.h>
arch/x86/include/asm/percpu.h+1−1
@@ -24,8 +24,8 @@ · 23 unmodified lines
24 24
25#else /* ...!ASSEMBLY */25#else /* ...!ASSEMBLY */
26 26
27#include <linux/kernel.h>
28#include <linux/stringify.h>27#include <linux/stringify.h>
28#include <asm/asm.h>
29 29
30#ifdef CONFIG_SMP30#ifdef CONFIG_SMP
31#define __percpu_prefix "%%"__stringify(__percpu_seg)":"31#define __percpu_prefix "%%"__stringify(__percpu_seg)":"
arch/x86/include/asm/preempt.h+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
6#include <asm/percpu.h>6#include <asm/percpu.h>
7#include <asm/current.h>7#include <asm/current.h>
8 8
9#include <linux/thread_info.h>
10#include <linux/static_call_types.h>9#include <linux/static_call_types.h>
11 10
12/* We use the MSB mostly because its available */11/* We use the MSB mostly because its available */
arch/x86/include/uapi/asm/signal.h+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
4 4
5#ifndef __ASSEMBLY__5#ifndef __ASSEMBLY__
6#include <linux/types.h>6#include <linux/types.h>
7#include <linux/time.h>
8#include <linux/compiler.h>7#include <linux/compiler.h>
9 8
10/* Avoid too many header ordering problems. */9/* Avoid too many header ordering problems. */
arch/x86/kernel/fpu/bugs.c+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
2/*2/*
3 * x86 FPU bug checks:3 * x86 FPU bug checks:
4 */4 */
5#include <asm/cpufeature.h>
5#include <asm/fpu/api.h>6#include <asm/fpu/api.h>
6 7
7/*8/*
arch/x86/kernel/signal.c+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#include <linux/context_tracking.h>27#include <linux/context_tracking.h>
28#include <linux/entry-common.h>28#include <linux/entry-common.h>
29#include <linux/syscalls.h>29#include <linux/syscalls.h>
30#include <linux/rseq.h>
30 31
31#include <asm/processor.h>32#include <asm/processor.h>
32#include <asm/ucontext.h>33#include <asm/ucontext.h>
arch/x86/lib/cache-smp.c+1−0
@@ -1,4 +1,5 @@
1// SPDX-License-Identifier: GPL-2.01// SPDX-License-Identifier: GPL-2.0
2#include <asm/paravirt.h>
2#include <linux/smp.h>3#include <linux/smp.h>
3#include <linux/export.h>4#include <linux/export.h>
4 5
arch/x86/um/sysrq_64.c+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
6 6
7#include <linux/kernel.h>7#include <linux/kernel.h>
8#include <linux/module.h>8#include <linux/module.h>
9#include <linux/pid.h>
9#include <linux/sched.h>10#include <linux/sched.h>
10#include <linux/sched/debug.h>11#include <linux/sched/debug.h>
11#include <linux/utsname.h>12#include <linux/utsname.h>
drivers/base/power/runtime.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#include <linux/export.h>11#include <linux/export.h>
12#include <linux/pm_runtime.h>12#include <linux/pm_runtime.h>
13#include <linux/pm_wakeirq.h>13#include <linux/pm_wakeirq.h>
14#include <linux/rculist.h>
14#include <trace/events/rpm.h>15#include <trace/events/rpm.h>
15 16
16#include "../base.h"17#include "../base.h"
drivers/gpu/drm/i915/i915_memcpy.c+2−0
@@ -23,6 +23,8 @@ · 22 unmodified lines
23 */23 */
24 24
25#include <linux/kernel.h>25#include <linux/kernel.h>
26#include <linux/string.h>
27#include <linux/cpufeature.h>
26#include <asm/fpu/api.h>28#include <asm/fpu/api.h>
27 29
28#include "i915_memcpy.h"30#include "i915_memcpy.h"
drivers/gpu/drm/lima/lima_ctx.c+1−0
@@ -1,6 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 OR MIT1// SPDX-License-Identifier: GPL-2.0 OR MIT
2/* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */2/* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */
3 3
4#include <linux/pid.h>
4#include <linux/slab.h>5#include <linux/slab.h>
5 6
6#include "lima_device.h"7#include "lima_device.h"
drivers/irqchip/irq-gic-v4.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#include <linux/irq.h>8#include <linux/irq.h>
9#include <linux/irqdomain.h>9#include <linux/irqdomain.h>
10#include <linux/msi.h>10#include <linux/msi.h>
11#include <linux/pid.h>
11#include <linux/sched.h>12#include <linux/sched.h>
12 13
13#include <linux/irqchip/arm-gic-v4.h>14#include <linux/irqchip/arm-gic-v4.h>
drivers/media/test-drivers/vidtv/vidtv_pes.c+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__14#define pr_fmt(fmt) KBUILD_MODNAME ":%s, %d: " fmt, __func__, __LINE__
15 15
16#include <linux/types.h>16#include <linux/types.h>
17#include <linux/math64.h>
17#include <linux/printk.h>18#include <linux/printk.h>
18#include <linux/ratelimit.h>19#include <linux/ratelimit.h>
19 20
drivers/target/target_core_xcopy.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/slab.h>15#include <linux/slab.h>
16#include <linux/spinlock.h>16#include <linux/spinlock.h>
17#include <linux/list.h>17#include <linux/list.h>
18#include <linux/rculist.h>
18#include <linux/configfs.h>19#include <linux/configfs.h>
19#include <linux/ratelimit.h>20#include <linux/ratelimit.h>
20#include <scsi/scsi_proto.h>21#include <scsi/scsi_proto.h>
fs/exec.c+1−0
@@ -66,6 +66,7 @@ · 65 unmodified lines
66#include <linux/coredump.h>66#include <linux/coredump.h>
67#include <linux/time_namespace.h>67#include <linux/time_namespace.h>
68#include <linux/user_events.h>68#include <linux/user_events.h>
69#include <linux/rseq.h>
69 70
70#include <linux/uaccess.h>71#include <linux/uaccess.h>
71#include <asm/mmu_context.h>72#include <asm/mmu_context.h>
include/linux/audit.h+1−0
@@ -36,6 +36,7 @@ struct mqstat; · 35 unmodified lines
36struct audit_watch;36struct audit_watch;
37struct audit_tree;37struct audit_tree;
38struct sk_buff;38struct sk_buff;
39struct kern_ipc_perm;
39 40
40struct audit_krule {41struct audit_krule {
41 u32 pflags;42 u32 pflags;
include/linux/dma-fence.h+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#include <linux/sched.h>21#include <linux/sched.h>
22#include <linux/printk.h>22#include <linux/printk.h>
23#include <linux/rcupdate.h>23#include <linux/rcupdate.h>
24#include <linux/timekeeping.h>
24 25
25struct dma_fence;26struct dma_fence;
26struct dma_fence_ops;27struct dma_fence_ops;
include/linux/hrtimer.h+3−43
@@ -13,13 +13,13 @@ · 12 unmodified lines
13#define _LINUX_HRTIMER_H13#define _LINUX_HRTIMER_H
14 14
15#include <linux/hrtimer_defs.h>15#include <linux/hrtimer_defs.h>
16#include <linux/rbtree.h>16#include <linux/hrtimer_types.h>
17#include <linux/init.h>17#include <linux/init.h>
18#include <linux/list.h>18#include <linux/list.h>
19#include <linux/percpu.h>19#include <linux/percpu-defs.h>
20#include <linux/rbtree.h>
20#include <linux/seqlock.h>21#include <linux/seqlock.h>
21#include <linux/timer.h>22#include <linux/timer.h>
22#include <linux/timerqueue.h>
23 23
24struct hrtimer_clock_base;24struct hrtimer_clock_base;
25struct hrtimer_cpu_base;25struct hrtimer_cpu_base;
@@ -59,14 +59,6 @@ enum hrtimer_mode { · 33 unmodified lines
59 HRTIMER_MODE_REL_PINNED_HARD = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_HARD,59 HRTIMER_MODE_REL_PINNED_HARD = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_HARD,
60};60};
61 61
62/*
63 * Return values for the callback function
64 */
65enum hrtimer_restart {
66 HRTIMER_NORESTART, /* Timer is not restarted */
67 HRTIMER_RESTART, /* Timer must be restarted */
68};
69
70/*62/*
71 * Values to track state of the timer63 * Values to track state of the timer
72 *64 *
@@ -94,38 +86,6 @@ enum hrtimer_restart { · 21 unmodified lines
94#define HRTIMER_STATE_INACTIVE 0x0086#define HRTIMER_STATE_INACTIVE 0x00
95#define HRTIMER_STATE_ENQUEUED 0x0187#define HRTIMER_STATE_ENQUEUED 0x01
96 88
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 */
118struct 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
129/**89/**
130 * struct hrtimer_sleeper - simple sleeper structure90 * struct hrtimer_sleeper - simple sleeper structure
131 * @timer: embedded timer structure91 * @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
8struct hrtimer_clock_base;
9
10/*
11 * Return values for the callback function
12 */
13enum 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 */
39struct 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
2#ifndef _LINUX_IPC_H2#ifndef _LINUX_IPC_H
3#define _LINUX_IPC_H3#define _LINUX_IPC_H
4 4
5#include <linux/spinlock.h>5#include <linux/spinlock_types.h>
6#include <linux/uidgid.h>6#include <linux/uidgid.h>
7#include <linux/rhashtable-types.h>7#include <linux/rhashtable-types.h>
8#include <uapi/linux/ipc.h>8#include <uapi/linux/ipc.h>
include/linux/irqflags.h+1−13
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#ifndef _LINUX_TRACE_IRQFLAGS_H12#ifndef _LINUX_TRACE_IRQFLAGS_H
13#define _LINUX_TRACE_IRQFLAGS_H13#define _LINUX_TRACE_IRQFLAGS_H
14 14
15#include <linux/irqflags_types.h>
15#include <linux/typecheck.h>16#include <linux/typecheck.h>
16#include <linux/cleanup.h>17#include <linux/cleanup.h>
17#include <asm/irqflags.h>18#include <asm/irqflags.h>
@@ -34,19 +35,6 @@ · 16 unmodified lines
34 35
35#ifdef CONFIG_TRACE_IRQFLAGS36#ifdef CONFIG_TRACE_IRQFLAGS
36 37
37/* Per-task IRQ trace events information. */
38struct 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
50DECLARE_PER_CPU(int, hardirqs_enabled);38DECLARE_PER_CPU(int, hardirqs_enabled);
51DECLARE_PER_CPU(int, hardirq_context);39DECLARE_PER_CPU(int, hardirq_context);
52 40
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. */
8struct 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
9#ifndef _LINUX_KMSAN_TYPES_H9#ifndef _LINUX_KMSAN_TYPES_H
10#define _LINUX_KMSAN_TYPES_H10#define _LINUX_KMSAN_TYPES_H
11 11
12#include <linux/types.h>
13
12/* These constants are defined in the MSan LLVM instrumentation pass. */14/* These constants are defined in the MSan LLVM instrumentation pass. */
13#define KMSAN_RETVAL_SIZE 80015#define KMSAN_RETVAL_SIZE 800
14#define KMSAN_PARAM_SIZE 80016#define KMSAN_PARAM_SIZE 800
include/linux/ktime.h+3−5
@@ -21,12 +21,10 @@ · 20 unmodified lines
21#ifndef _LINUX_KTIME_H21#ifndef _LINUX_KTIME_H
22#define _LINUX_KTIME_H22#define _LINUX_KTIME_H
23 23
24#include <linux/time.h>
25#include <linux/jiffies.h>
26#include <asm/bug.h>24#include <asm/bug.h>
27 25#include <linux/jiffies.h>
28/* Nanosecond scalar representation for kernel time values */26#include <linux/time.h>
29typedef s64 ktime_t;27#include <linux/types.h>
30 28
31/**29/**
32 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value30 * 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
82 u64 chain_key;82 u64 chain_key;
83};83};
84 84
85#define MAX_LOCKDEP_KEYS_BITS 13
86#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
87#define INITIAL_CHAIN_KEY -1
88
89struct 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
142/*85/*
143 * Initialization, self-test and debugging-output methods:86 * Initialization, self-test and debugging-output methods:
144 */87 */
include/linux/lockdep_types.h+57−0
@@ -198,6 +198,63 @@ struct lockdep_map { · 197 unmodified lines
198 198
199struct pin_cookie { unsigned int val; };199struct pin_cookie { unsigned int val; };
200 200
201#define MAX_LOCKDEP_KEYS_BITS 13
202#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
203#define INITIAL_CHAIN_KEY -1
204
205struct 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
201#else /* !CONFIG_LOCKDEP */258#else /* !CONFIG_LOCKDEP */
202 259
203/*260/*
include/linux/mm_types_task.h+2−3
@@ -9,9 +9,6 @@ · 8 unmodified lines
9 */9 */
10 10
11#include <linux/types.h>11#include <linux/types.h>
12#include <linux/threads.h>
13#include <linux/atomic.h>
14#include <linux/cpumask.h>
15 12
16#include <asm/page.h>13#include <asm/page.h>
17 14
@@ -36,6 +33,8 @@ enum { · 18 unmodified lines
36 NR_MM_COUNTERS33 NR_MM_COUNTERS
37};34};
38 35
36struct page;
37
39struct page_frag {38struct page_frag {
40 struct page *page;39 struct page *page;
41#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)40#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
include/linux/mutex.h+1−51
@@ -20,6 +20,7 @@ · 19 unmodified lines
20#include <linux/osq_lock.h>20#include <linux/osq_lock.h>
21#include <linux/debug_locks.h>21#include <linux/debug_locks.h>
22#include <linux/cleanup.h>22#include <linux/cleanup.h>
23#include <linux/mutex_types.h>
23 24
24#ifdef CONFIG_DEBUG_LOCK_ALLOC25#ifdef CONFIG_DEBUG_LOCK_ALLOC
25# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \26# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
@@ -33,49 +34,6 @@ · 7 unmodified lines
33 34
34#ifndef CONFIG_PREEMPT_RT35#ifndef CONFIG_PREEMPT_RT
35 36
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 */
64struct 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
79#ifdef CONFIG_DEBUG_MUTEXES37#ifdef CONFIG_DEBUG_MUTEXES
80 38
81#define __DEBUG_MUTEX_INITIALIZER(lockname) \39#define __DEBUG_MUTEX_INITIALIZER(lockname) \
@@ -131,14 +89,6 @@ extern bool mutex_is_locked(struct mutex *lock); · 49 unmodified lines
131/*89/*
132 * Preempt-RT variant based on rtmutexes.90 * Preempt-RT variant based on rtmutexes.
133 */91 */
134#include <linux/rtmutex.h>
135
136struct mutex {
137 struct rt_mutex_base rtmutex;
138#ifdef CONFIG_DEBUG_LOCK_ALLOC
139 struct lockdep_map dep_map;
140#endif
141};
142 92
143#define __MUTEX_INITIALIZER(mutexname) \93#define __MUTEX_INITIALIZER(mutexname) \
144{ \94{ \
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 */
41struct 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
62struct 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
93#include <linux/threads.h>93#include <linux/threads.h>
94#include <linux/bitmap.h>94#include <linux/bitmap.h>
95#include <linux/minmax.h>95#include <linux/minmax.h>
96#include <linux/nodemask_types.h>
96#include <linux/numa.h>97#include <linux/numa.h>
97#include <linux/random.h>98#include <linux/random.h>
98 99
99typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
100extern nodemask_t _unused_nodemask_arg_;100extern nodemask_t _unused_nodemask_arg_;
101 101
102/**102/**
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
8typedef 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
2#ifndef _LINUX_NSPROXY_H2#ifndef _LINUX_NSPROXY_H
3#define _LINUX_NSPROXY_H3#define _LINUX_NSPROXY_H
4 4
5#include <linux/refcount.h>
5#include <linux/spinlock.h>6#include <linux/spinlock.h>
6#include <linux/sched.h>7#include <linux/sched.h>
7 8
include/linux/numa.h+6−13
@@ -1,6 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_NUMA_H2#ifndef _LINUX_NUMA_H
3#define _LINUX_NUMA_H3#define _LINUX_NUMA_H
4#include <linux/init.h>
4#include <linux/types.h>5#include <linux/types.h>
5 6
6#ifdef CONFIG_NODES_SHIFT7#ifdef CONFIG_NODES_SHIFT
@@ -22,34 +23,26 @@ · 15 unmodified lines
22#endif23#endif
23 24
24#ifdef CONFIG_NUMA25#ifdef CONFIG_NUMA
25#include <linux/printk.h>
26#include <asm/sparsemem.h>26#include <asm/sparsemem.h>
27 27
28/* Generic implementation available */28/* Generic implementation available */
29int numa_nearest_node(int node, unsigned int state);29int numa_nearest_node(int node, unsigned int state);
30 30
31#ifndef memory_add_physaddr_to_nid31#ifndef memory_add_physaddr_to_nid
32static inline int memory_add_physaddr_to_nid(u64 start)32int 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}
38#endif33#endif
34
39#ifndef phys_to_target_node35#ifndef phys_to_target_node
40static inline int phys_to_target_node(u64 start)36int 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}
46#endif37#endif
38
47#ifndef numa_fill_memblks39#ifndef numa_fill_memblks
48static inline int __init numa_fill_memblks(u64 start, u64 end)40static inline int __init numa_fill_memblks(u64 start, u64 end)
49{41{
50 return NUMA_NO_MEMBLK;42 return NUMA_NO_MEMBLK;
51}43}
52#endif44#endif
45
53#else /* !CONFIG_NUMA */46#else /* !CONFIG_NUMA */
54static inline int numa_nearest_node(int node, unsigned int state)47static inline int numa_nearest_node(int node, unsigned int state)
55{48{
include/linux/pid.h+127−13
@@ -2,18 +2,12 @@ · 1 unmodified line
2#ifndef _LINUX_PID_H2#ifndef _LINUX_PID_H
3#define _LINUX_PID_H3#define _LINUX_PID_H
4 4
5#include <linux/pid_types.h>
5#include <linux/rculist.h>6#include <linux/rculist.h>
6#include <linux/wait.h>7#include <linux/rcupdate.h>
7#include <linux/refcount.h>8#include <linux/refcount.h>
8 9#include <linux/sched.h>
9enum pid_type10#include <linux/wait.h>
10{
11 PIDTYPE_PID,
12 PIDTYPE_TGID,
13 PIDTYPE_PGID,
14 PIDTYPE_SID,
15 PIDTYPE_MAX,
16};
17 11
18/*12/*
19 * What is struct pid?13 * What is struct pid?
@@ -110,9 +104,6 @@ extern void exchange_tids(struct task_struct *task, struct task_struct *old); · 90 unmodified lines
110extern void transfer_pid(struct task_struct *old, struct task_struct *new,104extern void transfer_pid(struct task_struct *old, struct task_struct *new,
111 enum pid_type);105 enum pid_type);
112 106
113struct pid_namespace;
114extern struct pid_namespace init_pid_ns;
115
116extern int pid_max;107extern int pid_max;
117extern int pid_max_min, pid_max_max;108extern int pid_max_min, pid_max_max;
118 109
@@ -215,4 +206,127 @@ pid_t pid_vnr(struct pid *pid); · 96 unmodified lines
215 } \206 } \
216 task = tg___; \207 task = tg___; \
217 } while_each_pid_task(pid, type, task)208 } while_each_pid_task(pid, type, task)
209
210static 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 */
226pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns);
227
228static inline pid_t task_pid_nr(struct task_struct *tsk)
229{
230 return tsk->pid;
231}
232
233static 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
238static inline pid_t task_pid_vnr(struct task_struct *tsk)
239{
240 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
241}
242
243
244static 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 */
259static inline int pid_alive(const struct task_struct *p)
260{
261 return p->thread_pid != NULL;
262}
263
264static 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
269static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
270{
271 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
272}
273
274
275static 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
280static inline pid_t task_session_vnr(struct task_struct *tsk)
281{
282 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
283}
284
285static 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
290static inline pid_t task_tgid_vnr(struct task_struct *tsk)
291{
292 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
293}
294
295static 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
307static 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: */
313static 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 */
327static inline int is_global_init(struct task_struct *tsk)
328{
329 return task_tgid_nr(tsk) == 1;
330}
331
218#endif /* _LINUX_PID_H */332#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
5enum pid_type {
6 PIDTYPE_PID,
7 PIDTYPE_TGID,
8 PIDTYPE_PGID,
9 PIDTYPE_SID,
10 PIDTYPE_MAX,
11};
12
13struct pid_namespace;
14extern 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
75 75
76#include <linux/container_of.h>76#include <linux/container_of.h>
77#include <linux/list.h>77#include <linux/list.h>
78#include <linux/types.h>78#include <linux/plist_types.h>
79 79
80#include <asm/bug.h>80#include <asm/bug.h>
81 81
82struct plist_head {
83 struct list_head node_list;
84};
85
86struct plist_node {
87 int prio;
88 struct list_head prio_list;
89 struct list_head node_list;
90};
91
92/**82/**
93 * PLIST_HEAD_INIT - static struct plist_head initializer83 * PLIST_HEAD_INIT - static struct plist_head initializer
94 * @head: struct plist_head variable name84 * @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
7struct plist_head {
8 struct list_head node_list;
9};
10
11struct 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
2#ifndef _linux_POSIX_TIMERS_H2#ifndef _linux_POSIX_TIMERS_H
3#define _linux_POSIX_TIMERS_H3#define _linux_POSIX_TIMERS_H
4 4
5#include <linux/spinlock.h>5#include <linux/alarmtimer.h>
6#include <linux/list.h>6#include <linux/list.h>
7#include <linux/mutex.h>7#include <linux/mutex.h>
8#include <linux/alarmtimer.h>8#include <linux/posix-timers_types.h>
9#include <linux/spinlock.h>
9#include <linux/timerqueue.h>10#include <linux/timerqueue.h>
10 11
11struct kernel_siginfo;12struct kernel_siginfo;
12struct task_struct;13struct task_struct;
13 14
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
39static inline clockid_t make_process_cpuclock(const unsigned int pid,15static inline clockid_t make_process_cpuclock(const unsigned int pid,
40 const clockid_t clock)16 const clockid_t clock)
41{17{
@@ -109,44 +85,6 @@ static inline void cpu_timer_setexpires(struct cpu_timer *ctmr, u64 exp) · 67 unmodified lines
109 ctmr->node.expires = exp;85 ctmr->node.expires = exp;
110}86}
111 87
112/**
113 * posix_cputimer_base - Container per posix CPU clock
114 * @nextevt: Earliest-expiration cache
115 * @tqhead: timerqueue head for cpu_timers
116 */
117struct 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 */
132struct 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 */
144struct posix_cputimers_work {
145 struct callback_head work;
146 struct mutex mutex;
147 unsigned int scheduled;
148};
149
150static inline void posix_cputimers_init(struct posix_cputimers *pct)88static inline void posix_cputimers_init(struct posix_cputimers *pct)
151{89{
152 memset(pct, 0, sizeof(*pct));90 memset(pct, 0, sizeof(*pct));
@@ -179,7 +117,6 @@ static inline void posix_cputimers_rt_watchdog(struct posix_cputimers *pct, · 26 unmodified lines
179 .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \117 .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \
180 },118 },
181#else119#else
182struct posix_cputimers { };
183struct cpu_timer { };120struct cpu_timer { };
184#define INIT_CPU_TIMERS(s)121#define INIT_CPU_TIMERS(s)
185static inline void posix_cputimers_init(struct posix_cputimers *pct) { }122static 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 */
41struct 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 */
56struct 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 */
68struct posix_cputimers_work {
69 struct callback_head work;
70 struct mutex mutex;
71 unsigned int scheduled;
72};
73
74#else /* CONFIG_POSIX_TIMERS */
75
76struct 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
10 10
11#include <linux/types.h>11#include <linux/types.h>
12#include <linux/once.h>12#include <linux/once.h>
13#include <linux/percpu.h>
14#include <linux/random.h>13#include <linux/random.h>
15 14
16struct rnd_state {15struct rnd_state {
include/linux/preempt.h+4−2
@@ -9,7 +9,7 @@ · 8 unmodified lines
9 9
10#include <linux/linkage.h>10#include <linux/linkage.h>
11#include <linux/cleanup.h>11#include <linux/cleanup.h>
12#include <linux/list.h>12#include <linux/types.h>
13 13
14/*14/*
15 * We put the hardirq and softirq counter into the preemption15 * 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
360static inline void preempt_notifier_init(struct preempt_notifier *notifier,360static inline void preempt_notifier_init(struct preempt_notifier *notifier,
361 struct preempt_ops *ops)361 struct preempt_ops *ops)
362{362{
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;
364 notifier->ops = ops;366 notifier->ops = ops;
365}367}
366 368
include/linux/rcupdate_wait.h+10−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8 8
9#include <linux/rcupdate.h>9#include <linux/rcupdate.h>
10#include <linux/completion.h>10#include <linux/completion.h>
11#include <linux/sched.h>
11 12
12/*13/*
13 * Structure allowing asynchronous waiting on RCU.14 * Structure allowing asynchronous waiting on RCU.
@@ -55,4 +56,13 @@ do { \ · 41 unmodified lines
55#define synchronize_rcu_mult(...) \56#define synchronize_rcu_mult(...) \
56 _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__)57 _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__)
57 58
59static 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
58#endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */68#endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */
include/linux/refcount.h+1−12
@@ -96,22 +96,11 @@ · 95 unmodified lines
96#include <linux/bug.h>96#include <linux/bug.h>
97#include <linux/compiler.h>97#include <linux/compiler.h>
98#include <linux/limits.h>98#include <linux/limits.h>
99#include <linux/refcount_types.h>
99#include <linux/spinlock_types.h>100#include <linux/spinlock_types.h>
100 101
101struct mutex;102struct mutex;
102 103
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 */
111typedef struct refcount_struct {
112 atomic_t refs;
113} refcount_t;
114
115#define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), }104#define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), }
116#define REFCOUNT_MAX INT_MAX105#define REFCOUNT_MAX INT_MAX
117#define REFCOUNT_SATURATED (INT_MIN / 2)106#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 */
15typedef 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
7 7
8#include <linux/compiler.h>8#include <linux/compiler.h>
9#include <linux/types.h>9#include <linux/types.h>
10#include <linux/time64.h>
11 10
11struct __kernel_timespec;
12struct timespec;12struct timespec;
13struct old_timespec32;13struct old_timespec32;
14struct pollfd;14struct pollfd;
include/linux/resume_user_mode.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
6#include <linux/sched.h>6#include <linux/sched.h>
7#include <linux/task_work.h>7#include <linux/task_work.h>
8#include <linux/memcontrol.h>8#include <linux/memcontrol.h>
9#include <linux/rseq.h>
9#include <linux/blk-cgroup.h>10#include <linux/blk-cgroup.h>
10 11
11/**12/**
include/linux/rhashtable-types.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12#include <linux/atomic.h>12#include <linux/atomic.h>
13#include <linux/compiler.h>13#include <linux/compiler.h>
14#include <linux/mutex.h>14#include <linux/mutex.h>
15#include <linux/workqueue.h>15#include <linux/workqueue_types.h>
16 16
17struct rhash_head {17struct rhash_head {
18 struct rhash_head __rcu *next;18 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 */
14enum 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
20enum 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
26static 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
32void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs);
33
34static 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
41static 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. */
51static 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. */
58static 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 */
68static 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
83static 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
93static inline void rseq_set_notify_resume(struct task_struct *t)
94{
95}
96static inline void rseq_handle_notify_resume(struct ksignal *ksig,
97 struct pt_regs *regs)
98{
99}
100static inline void rseq_signal_deliver(struct ksignal *ksig,
101 struct pt_regs *regs)
102{
103}
104static inline void rseq_preempt(struct task_struct *t)
105{
106}
107static inline void rseq_migrate(struct task_struct *t)
108{
109}
110static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
111{
112}
113static inline void rseq_execve(struct task_struct *t)
114{
115}
116
117#endif
118
119#ifdef CONFIG_DEBUG_RSEQ
120
121void rseq_syscall(struct pt_regs *regs);
122
123#else
124
125static 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
10#ifndef _RSLIB_H_10#ifndef _RSLIB_H_
11#define _RSLIB_H_11#define _RSLIB_H_
12 12
13#include <linux/list.h>
14#include <linux/types.h> /* for gfp_t */13#include <linux/types.h> /* for gfp_t */
15#include <linux/gfp.h> /* for GFP_KERNEL */14#include <linux/gfp.h> /* for GFP_KERNEL */
16 15
include/linux/sched.h+25−300
@@ -10,33 +10,41 @@ · 9 unmodified lines
10#include <uapi/linux/sched.h>10#include <uapi/linux/sched.h>
11 11
12#include <asm/current.h>12#include <asm/current.h>
13 13#include <asm/processor.h>
14#include <linux/pid.h>14#include <linux/thread_info.h>
15#include <linux/sem.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>
16#include <linux/shm.h>23#include <linux/shm.h>
17#include <linux/kmsan_types.h>24#include <linux/kmsan_types.h>
18#include <linux/mutex.h>25#include <linux/mutex_types.h>
19#include <linux/plist.h>26#include <linux/plist_types.h>
20#include <linux/hrtimer.h>27#include <linux/hrtimer_types.h>
21#include <linux/irqflags.h>28#include <linux/timer_types.h>
22#include <linux/seccomp.h>29#include <linux/seccomp_types.h>
23#include <linux/nodemask.h>30#include <linux/nodemask_types.h>
24#include <linux/rcupdate.h>31#include <linux/refcount_types.h>
25#include <linux/refcount.h>
26#include <linux/resource.h>32#include <linux/resource.h>
27#include <linux/latencytop.h>33#include <linux/latencytop.h>
28#include <linux/sched/prio.h>34#include <linux/sched/prio.h>
29#include <linux/sched/types.h>35#include <linux/sched/types.h>
30#include <linux/signal_types.h>36#include <linux/signal_types.h>
31#include <linux/syscall_user_dispatch.h>37#include <linux/syscall_user_dispatch_types.h>
32#include <linux/mm_types_task.h>38#include <linux/mm_types_task.h>
33#include <linux/task_io_accounting.h>39#include <linux/task_io_accounting.h>
34#include <linux/posix-timers.h>40#include <linux/posix-timers_types.h>
35#include <linux/rseq.h>41#include <linux/restart_block.h>
36#include <linux/seqlock.h>42#include <uapi/linux/rseq.h>
43#include <linux/seqlock_types.h>
37#include <linux/kcsan.h>44#include <linux/kcsan.h>
38#include <linux/rv.h>45#include <linux/rv.h>
39#include <linux/livepatch_sched.h>46#include <linux/livepatch_sched.h>
47#include <linux/uidgid_types.h>
40#include <asm/kmap_size.h>48#include <asm/kmap_size.h>
41 49
42/* task_struct member predeclarations (sorted alphabetically): */50/* task_struct member predeclarations (sorted alphabetically): */
@@ -1556,114 +1564,6 @@ struct task_struct { · 1513 unmodified lines
1556 */1564 */
1557};1565};
1558 1566
1559static 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 */
1575pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, struct pid_namespace *ns);
1576
1577static inline pid_t task_pid_nr(struct task_struct *tsk)
1578{
1579 return tsk->pid;
1580}
1581
1582static 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
1587static inline pid_t task_pid_vnr(struct task_struct *tsk)
1588{
1589 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1590}
1591
1592
1593static 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 */
1608static inline int pid_alive(const struct task_struct *p)
1609{
1610 return p->thread_pid != NULL;
1611}
1612
1613static 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
1618static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1619{
1620 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1621}
1622
1623
1624static 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
1629static inline pid_t task_session_vnr(struct task_struct *tsk)
1630{
1631 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1632}
1633
1634static 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
1639static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1640{
1641 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
1642}
1643
1644static 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
1656static 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: */
1662static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1663{
1664 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1665}
1666
1667#define TASK_REPORT_IDLE (TASK_REPORT + 1)1567#define TASK_REPORT_IDLE (TASK_REPORT + 1)
1668#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)1568#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)
1669 1569
@@ -1707,20 +1607,6 @@ static inline char task_state_to_char(struct task_struct *tsk) · 37 unmodified lines
1707 return task_index_to_char(task_state_index(tsk));1607 return task_index_to_char(task_state_index(tsk));
1708}1608}
1709 1609
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 */
1719static inline int is_global_init(struct task_struct *tsk)
1720{
1721 return task_tgid_nr(tsk) == 1;
1722}
1723
1724extern struct pid *cad_pid;1610extern struct pid *cad_pid;
1725 1611
1726/*1612/*
@@ -2170,15 +2056,6 @@ extern int __cond_resched_rwlock_write(rwlock_t *lock); · 443 unmodified lines
2170 __cond_resched_rwlock_write(lock); \2056 __cond_resched_rwlock_write(lock); \
2171})2057})
2172 2058
2173static 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
2182#ifdef CONFIG_PREEMPT_DYNAMIC2059#ifdef CONFIG_PREEMPT_DYNAMIC
2183 2060
2184extern bool preempt_model_none(void);2061extern bool preempt_model_none(void);
@@ -2220,37 +2097,6 @@ static inline bool preempt_model_preemptible(void) · 35 unmodified lines
2220 return preempt_model_full() || preempt_model_rt();2097 return preempt_model_full() || preempt_model_rt();
2221}2098}
2222 2099
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 */
2228static 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 */
2245static 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
2254static __always_inline bool need_resched(void)2100static __always_inline bool need_resched(void)
2255{2101{
2256 return unlikely(tif_need_resched());2102 return unlikely(tif_need_resched());
@@ -2285,6 +2131,8 @@ extern bool sched_task_on_rq(struct task_struct *p); · 28 unmodified lines
2285extern unsigned long get_wchan(struct task_struct *p);2131extern unsigned long get_wchan(struct task_struct *p);
2286extern struct task_struct *cpu_curr_snapshot(int cpu);2132extern struct task_struct *cpu_curr_snapshot(int cpu);
2287 2133
2134#include <linux/spinlock.h>
2135
2288/*2136/*
2289 * In order to reduce various lock holder preemption latencies provide an2137 * In order to reduce various lock holder preemption latencies provide an
2290 * interface to see if a vCPU is currently running or not.2138 * 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
2321unsigned long sched_cpu_util(int cpu);2169unsigned long sched_cpu_util(int cpu);
2322#endif /* CONFIG_SMP */2170#endif /* CONFIG_SMP */
2323 2171
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 */
2330enum 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
2336enum 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
2342static 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
2348void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs);
2349
2350static 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
2357static 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. */
2367static 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. */
2374static 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 */
2384static 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
2399static 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
2409static inline void rseq_set_notify_resume(struct task_struct *t)
2410{
2411}
2412static inline void rseq_handle_notify_resume(struct ksignal *ksig,
2413 struct pt_regs *regs)
2414{
2415}
2416static inline void rseq_signal_deliver(struct ksignal *ksig,
2417 struct pt_regs *regs)
2418{
2419}
2420static inline void rseq_preempt(struct task_struct *t)
2421{
2422}
2423static inline void rseq_migrate(struct task_struct *t)
2424{
2425}
2426static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
2427{
2428}
2429static inline void rseq_execve(struct task_struct *t)
2430{
2431}
2432
2433#endif
2434
2435#ifdef CONFIG_DEBUG_RSEQ
2436
2437void rseq_syscall(struct pt_regs *regs);
2438
2439#else
2440
2441static inline void rseq_syscall(struct pt_regs *regs)
2442{
2443}
2444
2445#endif
2446
2447#ifdef CONFIG_SCHED_CORE2172#ifdef CONFIG_SCHED_CORE
2448extern void sched_core_free(struct task_struct *tsk);2173extern void sched_core_free(struct task_struct *tsk);
2449extern void sched_core_fork(struct task_struct *p);2174extern void sched_core_fork(struct task_struct *p);
include/linux/sched/signal.h+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#include <linux/sched/task.h>9#include <linux/sched/task.h>
10#include <linux/cred.h>10#include <linux/cred.h>
11#include <linux/refcount.h>11#include <linux/refcount.h>
12#include <linux/pid.h>
12#include <linux/posix-timers.h>13#include <linux/posix-timers.h>
13#include <linux/mm_types.h>14#include <linux/mm_types.h>
14#include <asm/ptrace.h>15#include <asm/ptrace.h>
include/linux/sched/task.h+2−0
@@ -7,6 +7,8 @@ · 6 unmodified lines
7 * functionality:7 * functionality:
8 */8 */
9 9
10#include <linux/rcupdate.h>
11#include <linux/refcount.h>
10#include <linux/sched.h>12#include <linux/sched.h>
11#include <linux/uaccess.h>13#include <linux/uaccess.h>
12 14
include/linux/sched/task_stack.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8 8
9#include <linux/sched.h>9#include <linux/sched.h>
10#include <linux/magic.h>10#include <linux/magic.h>
11#include <linux/refcount.h>
11 12
12#ifdef CONFIG_THREAD_INFO_IN_TASK13#ifdef CONFIG_THREAD_INFO_IN_TASK
13 14
include/linux/seccomp.h+3−21
@@ -3,6 +3,7 @@ · 2 unmodified lines
3#define _LINUX_SECCOMP_H3#define _LINUX_SECCOMP_H
4 4
5#include <uapi/linux/seccomp.h>5#include <uapi/linux/seccomp.h>
6#include <linux/seccomp_types.h>
6 7
7#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \8#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
8 SECCOMP_FILTER_FLAG_LOG | \9 SECCOMP_FILTER_FLAG_LOG | \
@@ -21,25 +22,6 @@ · 12 unmodified lines
21#include <linux/atomic.h>22#include <linux/atomic.h>
22#include <asm/seccomp.h>23#include <asm/seccomp.h>
23 24
24struct 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 */
37struct seccomp {
38 int mode;
39 atomic_t filter_count;
40 struct seccomp_filter *filter;
41};
42
43#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER25#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
44extern int __secure_computing(const struct seccomp_data *sd);26extern int __secure_computing(const struct seccomp_data *sd);
45static inline int secure_computing(void)27static inline int secure_computing(void)
@@ -64,8 +46,6 @@ static inline int seccomp_mode(struct seccomp *s) · 18 unmodified lines
64 46
65#include <linux/errno.h>47#include <linux/errno.h>
66 48
67struct seccomp { };
68struct seccomp_filter { };
69struct seccomp_data;49struct seccomp_data;
70 50
71#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER51#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
@@ -126,6 +106,8 @@ static inline long seccomp_get_metadata(struct task_struct *task, · 54 unmodified lines
126 106
127#ifdef CONFIG_SECCOMP_CACHE_DEBUG107#ifdef CONFIG_SECCOMP_CACHE_DEBUG
128struct seq_file;108struct seq_file;
109struct pid_namespace;
110struct pid;
129 111
130int proc_pid_seccomp_cache(struct seq_file *m, struct pid_namespace *ns,112int proc_pid_seccomp_cache(struct seq_file *m, struct pid_namespace *ns,
131 struct pid *pid, struct task_struct *task);113 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
9struct 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 */
22struct seccomp {
23 int mode;
24 atomic_t filter_count;
25 struct seccomp_filter *filter;
26};
27
28#else
29
30struct seccomp { };
31struct 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
3#define _LINUX_SEM_H3#define _LINUX_SEM_H
4 4
5#include <uapi/linux/sem.h>5#include <uapi/linux/sem.h>
6#include <linux/sem_types.h>
6 7
7struct task_struct;8struct task_struct;
8struct sem_undo_list;
9 9
10#ifdef CONFIG_SYSVIPC10#ifdef CONFIG_SYSVIPC
11 11
12struct sysv_sem {
13 struct sem_undo_list *undo_list;
14};
15
16extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);12extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
17extern void exit_sem(struct task_struct *tsk);13extern void exit_sem(struct task_struct *tsk);
18 14
19#else15#else
20 16
21struct sysv_sem {
22 /* empty */
23};
24
25static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)17static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
26{18{
27 return 0;19 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
5struct sem_undo_list;
6
7struct 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
18#include <linux/lockdep.h>18#include <linux/lockdep.h>
19#include <linux/mutex.h>19#include <linux/mutex.h>
20#include <linux/preempt.h>20#include <linux/preempt.h>
21#include <linux/seqlock_types.h>
21#include <linux/spinlock.h>22#include <linux/spinlock.h>
22 23
23#include <asm/processor.h>24#include <asm/processor.h>
@@ -37,37 +38,6 @@ · 13 unmodified lines
37 */38 */
38#define KCSAN_SEQLOCK_REGION_MAX 100039#define KCSAN_SEQLOCK_REGION_MAX 1000
39 40
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 */
64typedef struct seqcount {
65 unsigned sequence;
66#ifdef CONFIG_DEBUG_LOCK_ALLOC
67 struct lockdep_map dep_map;
68#endif
69} seqcount_t;
70
71static inline void __seqcount_init(seqcount_t *s, const char *name,41static inline void __seqcount_init(seqcount_t *s, const char *name,
72 struct lock_class_key *key)42 struct lock_class_key *key)
73{43{
@@ -131,28 +101,6 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 57 unmodified lines
131 * See Documentation/locking/seqlock.rst101 * See Documentation/locking/seqlock.rst
132 */102 */
133 103
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
156/*104/*
157 * typedef seqcount_LOCKNAME_t - sequence counter with LOCKNAME associated105 * typedef seqcount_LOCKNAME_t - sequence counter with LOCKNAME associated
158 * @seqcount: The real sequence counter106 * @seqcount: The real sequence counter
@@ -194,11 +142,6 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 35 unmodified lines
194 * @lockbase: prefix for associated lock/unlock142 * @lockbase: prefix for associated lock/unlock
195 */143 */
196#define SEQCOUNT_LOCKNAME(lockname, locktype, preemptible, lockbase) \144#define SEQCOUNT_LOCKNAME(lockname, locktype, preemptible, lockbase) \
197typedef struct seqcount_##lockname { \
198 seqcount_t seqcount; \
199 __SEQ_LOCK(locktype *lock); \
200} seqcount_##lockname##_t; \
201 \
202static __always_inline seqcount_t * \145static __always_inline seqcount_t * \
203__seqprop_##lockname##_ptr(seqcount_##lockname##_t *s) \146__seqprop_##lockname##_ptr(seqcount_##lockname##_t *s) \
204{ \147{ \
@@ -284,6 +227,7 @@ SEQCOUNT_LOCKNAME(raw_spinlock, raw_spinlock_t, false, raw_spin) · 79 unmodified lines
284SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, spin)227SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, spin)
285SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, read)228SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, read)
286SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)229SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
230#undef SEQCOUNT_LOCKNAME
287 231
288/*232/*
289 * SEQCNT_LOCKNAME_ZERO - static initializer for seqcount_LOCKNAME_t233 * 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
794 smp_wmb(); /* increment "sequence" before following stores */738 smp_wmb(); /* increment "sequence" before following stores */
795}739}
796 740
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 */
807typedef 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
816#define __SEQLOCK_UNLOCKED(lockname) \741#define __SEQLOCK_UNLOCKED(lockname) \
817 { \742 { \
818 .seqcount = SEQCNT_SPINLOCK_ZERO(lockname, &(lockname).lock), \743 .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 */
33typedef 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) \
63typedef struct seqcount_##lockname { \
64 seqcount_t seqcount; \
65 __SEQ_LOCK(locktype *lock); \
66} seqcount_##lockname##_t;
67
68SEQCOUNT_LOCKNAME(raw_spinlock, raw_spinlock_t, false, raw_spin)
69SEQCOUNT_LOCKNAME(spinlock, spinlock_t, __SEQ_RT, spin)
70SEQCOUNT_LOCKNAME(rwlock, rwlock_t, __SEQ_RT, read)
71SEQCOUNT_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 */
84typedef 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
2#ifndef _LINUX_SHM_H_2#ifndef _LINUX_SHM_H_
3#define _LINUX_SHM_H_3#define _LINUX_SHM_H_
4 4
5#include <linux/list.h>5#include <linux/types.h>
6#include <asm/page.h>6#include <asm/page.h>
7#include <uapi/linux/shm.h>
8#include <asm/shmparam.h>7#include <asm/shmparam.h>
9 8
10struct file;9struct file;
10struct task_struct;
11 11
12#ifdef CONFIG_SYSVIPC12#ifdef CONFIG_SYSVIPC
13struct sysv_shm {13struct sysv_shm {
include/linux/signal.h+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
3#define _LINUX_SIGNAL_H3#define _LINUX_SIGNAL_H
4 4
5#include <linux/bug.h>5#include <linux/bug.h>
6#include <linux/list.h>
6#include <linux/signal_types.h>7#include <linux/signal_types.h>
7#include <linux/string.h>8#include <linux/string.h>
8 9
include/linux/signal_types.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
6 * Basic signal handling related data type definitions:6 * Basic signal handling related data type definitions:
7 */7 */
8 8
9#include <linux/list.h>9#include <linux/types.h>
10#include <uapi/linux/signal.h>10#include <uapi/linux/signal.h>
11 11
12typedef struct kernel_siginfo {12typedef 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
449 return raw_spin_is_contended(&lock->rlock);449 return raw_spin_is_contended(&lock->rlock);
450}450}
451 451
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 */
457static 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 */
474static 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
452#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)483#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
453 484
454#else /* !CONFIG_PREEMPT_RT */485#else /* !CONFIG_PREEMPT_RT */
include/linux/syscall_user_dispatch.h+1−8
@@ -6,16 +6,10 @@ · 5 unmodified lines
6#define _SYSCALL_USER_DISPATCH_H6#define _SYSCALL_USER_DISPATCH_H
7 7
8#include <linux/thread_info.h>8#include <linux/thread_info.h>
9#include <linux/syscall_user_dispatch_types.h>
9 10
10#ifdef CONFIG_GENERIC_ENTRY11#ifdef CONFIG_GENERIC_ENTRY
11 12
12struct syscall_user_dispatch {
13 char __user *selector;
14 unsigned long offset;
15 unsigned long len;
16 bool on_dispatch;
17};
18
19int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,13int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
20 unsigned long len, char __user *selector);14 unsigned long len, char __user *selector);
21 15
@@ -29,7 +23,6 @@ int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long siz · 7 unmodified lines
29 void __user *data);23 void __user *data);
30 24
31#else25#else
32struct syscall_user_dispatch {};
33 26
34static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,27static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
35 unsigned long len, char __user *selector)28 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
9struct syscall_user_dispatch {
10 char __user *selector;
11 unsigned long offset;
12 unsigned long len;
13 bool on_dispatch;
14};
15
16#else
17
18struct 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
7#include <linux/nsproxy.h>7#include <linux/nsproxy.h>
8#include <linux/ns_common.h>8#include <linux/ns_common.h>
9#include <linux/err.h>9#include <linux/err.h>
10#include <linux/time64.h>
10 11
11struct user_namespace;12struct user_namespace;
12extern struct user_namespace init_user_ns;13extern struct user_namespace init_user_ns;
13 14
15struct vm_area_struct;
16
14struct timens_offsets {17struct timens_offsets {
15 struct timespec64 monotonic;18 struct timespec64 monotonic;
16 struct timespec64 boottime;19 struct timespec64 boottime;
include/linux/timekeeping.h+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 4
5#include <linux/errno.h>5#include <linux/errno.h>
6#include <linux/clocksource_ids.h>6#include <linux/clocksource_ids.h>
7#include <linux/ktime.h>
7 8
8/* Included from linux/ktime.h */9/* Included from linux/ktime.h */
9 10
include/linux/timer.h+1−15
@@ -7,21 +7,7 @@ · 6 unmodified lines
7#include <linux/stddef.h>7#include <linux/stddef.h>
8#include <linux/debugobjects.h>8#include <linux/debugobjects.h>
9#include <linux/stringify.h>9#include <linux/stringify.h>
10 10#include <linux/timer_types.h>
11struct 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};
25 11
26#ifdef CONFIG_LOCKDEP12#ifdef CONFIG_LOCKDEP
27/*13/*
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
8struct 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
3#define _LINUX_TIMERQUEUE_H3#define _LINUX_TIMERQUEUE_H
4 4
5#include <linux/rbtree.h>5#include <linux/rbtree.h>
6#include <linux/ktime.h>6#include <linux/timerqueue_types.h>
7
8
9struct timerqueue_node {
10 struct rb_node node;
11 ktime_t expires;
12};
13
14struct timerqueue_head {
15 struct rb_root_cached rb_root;
16};
17
18 7
19extern bool timerqueue_add(struct timerqueue_head *head,8extern bool timerqueue_add(struct timerqueue_head *head,
20 struct timerqueue_node *node);9 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
8struct timerqueue_node {
9 struct rb_node node;
10 ktime_t expires;
11};
12
13struct 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
21#include <linux/debugobjects.h>21#include <linux/debugobjects.h>
22#include <linux/bug.h>22#include <linux/bug.h>
23#include <linux/compiler.h>23#include <linux/compiler.h>
24#include <linux/hrtimer.h>
24 25
25/* Definitions for a non-string torture-test module parameter. */26/* Definitions for a non-string torture-test module parameter. */
26#define torture_param(type, name, init, msg) \27#define torture_param(type, name, init, msg) \
include/linux/types.h+3−0
@@ -120,6 +120,9 @@ typedef s64 int64_t; · 119 unmodified lines
120#define aligned_be64 __aligned_be64120#define aligned_be64 __aligned_be64
121#define aligned_le64 __aligned_le64121#define aligned_le64 __aligned_le64
122 122
123/* Nanosecond scalar representation for kernel time values */
124typedef s64 ktime_t;
125
123/**126/**
124 * The type used for indexing onto a disc or disc partition.127 * The type used for indexing onto a disc or disc partition.
125 *128 *
include/linux/uidgid.h+1−10
@@ -12,22 +12,13 @@ · 11 unmodified lines
12 * to detect when we overlook these differences.12 * to detect when we overlook these differences.
13 *13 *
14 */14 */
15#include <linux/types.h>15#include <linux/uidgid_types.h>
16#include <linux/highuid.h>16#include <linux/highuid.h>
17 17
18struct user_namespace;18struct user_namespace;
19extern struct user_namespace init_user_ns;19extern struct user_namespace init_user_ns;
20struct uid_gid_map;20struct uid_gid_map;
21 21
22typedef struct {
23 uid_t val;
24} kuid_t;
25
26
27typedef struct {
28 gid_t val;
29} kgid_t;
30
31#define KUIDT_INIT(value) (kuid_t){ value }22#define KUIDT_INIT(value) (kuid_t){ value }
32#define KGIDT_INIT(value) (kgid_t){ value }23#define KGIDT_INIT(value) (kgid_t){ value }
33 24
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
7typedef struct {
8 uid_t val;
9} kuid_t;
10
11typedef 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
9#include <linux/spinlock.h>9#include <linux/spinlock.h>
10 10
11#include <asm/current.h>11#include <asm/current.h>
12#include <uapi/linux/wait.h>
13 12
14typedef struct wait_queue_entry wait_queue_entry_t;13typedef struct wait_queue_entry wait_queue_entry_t;
15 14
include/linux/workqueue.h+1−15
@@ -14,12 +14,7 @@ · 13 unmodified lines
14#include <linux/atomic.h>14#include <linux/atomic.h>
15#include <linux/cpumask.h>15#include <linux/cpumask.h>
16#include <linux/rcupdate.h>16#include <linux/rcupdate.h>
17 17#include <linux/workqueue_types.h>
18struct workqueue_struct;
19
20struct work_struct;
21typedef void (*work_func_t)(struct work_struct *work);
22void delayed_work_timer_fn(struct timer_list *t);
23 18
24/*19/*
25 * The first word is the work queue pointer and the flags rolled into20 * The first word is the work queue pointer and the flags rolled into
@@ -95,15 +90,6 @@ enum { · 69 unmodified lines
95#define WORK_STRUCT_FLAG_MASK ((1ul << WORK_STRUCT_FLAG_BITS) - 1)90#define WORK_STRUCT_FLAG_MASK ((1ul << WORK_STRUCT_FLAG_BITS) - 1)
96#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)91#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
97 92
98struct 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
107#define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL)93#define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL)
108#define WORK_DATA_STATIC_INIT() \94#define WORK_DATA_STATIC_INIT() \
109 ATOMIC_LONG_INIT((unsigned long)(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC))95 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
10struct workqueue_struct;
11
12struct work_struct;
13typedef void (*work_func_t)(struct work_struct *work);
14void delayed_work_timer_fn(struct timer_list *t);
15
16struct 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
2#ifndef _UAPI_LINUX_RESOURCE_H2#ifndef _UAPI_LINUX_RESOURCE_H
3#define _UAPI_LINUX_RESOURCE_H3#define _UAPI_LINUX_RESOURCE_H
4 4
5#include <linux/time.h>5#include <linux/time_types.h>
6#include <linux/types.h>6#include <linux/types.h>
7 7
8/*8/*
init/init_task.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include <linux/audit.h>12#include <linux/audit.h>
13#include <linux/numa.h>13#include <linux/numa.h>
14#include <linux/scs.h>14#include <linux/scs.h>
15#include <linux/plist.h>
15 16
16#include <linux/uaccess.h>17#include <linux/uaccess.h>
17 18
ipc/shm.c+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
29#include <linux/mm.h>29#include <linux/mm.h>
30#include <linux/hugetlb.h>30#include <linux/hugetlb.h>
31#include <linux/shm.h>31#include <linux/shm.h>
32#include <uapi/linux/shm.h>
32#include <linux/init.h>33#include <linux/init.h>
33#include <linux/file.h>34#include <linux/file.h>
34#include <linux/mman.h>35#include <linux/mman.h>
ipc/util.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#include <linux/unistd.h>14#include <linux/unistd.h>
15#include <linux/err.h>15#include <linux/err.h>
16#include <linux/ipc_namespace.h>16#include <linux/ipc_namespace.h>
17#include <linux/pid.h>
17 18
18/*19/*
19 * The IPC ID contains 2 separate numbers - index and sequence number.20 * 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
114obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o114obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
115obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o115obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
116obj-$(CONFIG_CFI_CLANG) += cfi.o116obj-$(CONFIG_CFI_CLANG) += cfi.o
117obj-$(CONFIG_NUMA) += numa.o
117 118
118obj-$(CONFIG_PERF_EVENTS) += events/119obj-$(CONFIG_PERF_EVENTS) += events/
119 120
kernel/async.c+3−2
@@ -46,11 +46,12 @@ asynchronous and synchronous parts of the kernel. · 45 unmodified lines
46 46
47#include <linux/async.h>47#include <linux/async.h>
48#include <linux/atomic.h>48#include <linux/atomic.h>
49#include <linux/ktime.h>
50#include <linux/export.h>49#include <linux/export.h>
51#include <linux/wait.h>50#include <linux/ktime.h>
51#include <linux/pid.h>
52#include <linux/sched.h>52#include <linux/sched.h>
53#include <linux/slab.h>53#include <linux/slab.h>
54#include <linux/wait.h>
54#include <linux/workqueue.h>55#include <linux/workqueue.h>
55 56
56#include "workqueue_internal.h"57#include "workqueue_internal.h"
kernel/bpf/hashtab.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#include <linux/jhash.h>7#include <linux/jhash.h>
8#include <linux/filter.h>8#include <linux/filter.h>
9#include <linux/rculist_nulls.h>9#include <linux/rculist_nulls.h>
10#include <linux/rcupdate_wait.h>
10#include <linux/random.h>11#include <linux/random.h>
11#include <uapi/linux/btf.h>12#include <uapi/linux/btf.h>
12#include <linux/rcupdate_trace.h>13#include <linux/rcupdate_trace.h>
kernel/exit.c+3−1
@@ -69,8 +69,10 @@ · 68 unmodified lines
69#include <linux/rethook.h>69#include <linux/rethook.h>
70#include <linux/sysfs.h>70#include <linux/sysfs.h>
71#include <linux/user_events.h>71#include <linux/user_events.h>
72
73#include <linux/uaccess.h>72#include <linux/uaccess.h>
73
74#include <uapi/linux/wait.h>
75
74#include <asm/unistd.h>76#include <asm/unistd.h>
75#include <asm/mmu_context.h>77#include <asm/mmu_context.h>
76 78
kernel/fork.c+2−0
@@ -53,6 +53,7 @@ · 52 unmodified lines
53#include <linux/seccomp.h>53#include <linux/seccomp.h>
54#include <linux/swap.h>54#include <linux/swap.h>
55#include <linux/syscalls.h>55#include <linux/syscalls.h>
56#include <linux/syscall_user_dispatch.h>
56#include <linux/jiffies.h>57#include <linux/jiffies.h>
57#include <linux/futex.h>58#include <linux/futex.h>
58#include <linux/compat.h>59#include <linux/compat.h>
@@ -99,6 +100,7 @@ · 40 unmodified lines
99#include <linux/stackprotector.h>100#include <linux/stackprotector.h>
100#include <linux/user_events.h>101#include <linux/user_events.h>
101#include <linux/iommu.h>102#include <linux/iommu.h>
103#include <linux/rseq.h>
102 104
103#include <asm/pgalloc.h>105#include <asm/pgalloc.h>
104#include <linux/uaccess.h>106#include <linux/uaccess.h>
kernel/futex/core.c+1−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include <linux/compat.h>34#include <linux/compat.h>
35#include <linux/jhash.h>35#include <linux/jhash.h>
36#include <linux/pagemap.h>36#include <linux/pagemap.h>
37#include <linux/plist.h>
37#include <linux/memblock.h>38#include <linux/memblock.h>
38#include <linux/fault-inject.h>39#include <linux/fault-inject.h>
39#include <linux/slab.h>40#include <linux/slab.h>
kernel/futex/requeue.c+1−0
@@ -1,5 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0-or-later1// SPDX-License-Identifier: GPL-2.0-or-later
2 2
3#include <linux/plist.h>
3#include <linux/sched/signal.h>4#include <linux/sched/signal.h>
4 5
5#include "futex.h"6#include "futex.h"
kernel/futex/waitwake.c+1−0
@@ -1,5 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0-or-later1// SPDX-License-Identifier: GPL-2.0-or-later
2 2
3#include <linux/plist.h>
3#include <linux/sched/task.h>4#include <linux/sched/task.h>
4#include <linux/sched/signal.h>5#include <linux/sched/signal.h>
5#include <linux/freezer.h>6#include <linux/freezer.h>
kernel/locking/spinlock_debug.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include <linux/debug_locks.h>12#include <linux/debug_locks.h>
13#include <linux/delay.h>13#include <linux/delay.h>
14#include <linux/export.h>14#include <linux/export.h>
15#include <linux/pid.h>
15 16
16void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,17void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
17 struct lock_class_key *key, short inner)18 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
9int 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}
15EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
16#endif
17
18#ifndef phys_to_target_node
19int 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}
25EXPORT_SYMBOL_GPL(phys_to_target_node);
26#endif
kernel/pid_namespace.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#include <linux/sched/task.h>23#include <linux/sched/task.h>
24#include <linux/sched/signal.h>24#include <linux/sched/signal.h>
25#include <linux/idr.h>25#include <linux/idr.h>
26#include <uapi/linux/wait.h>
26#include "pid_sysctl.h"27#include "pid_sysctl.h"
27 28
28static DEFINE_MUTEX(pid_caches_mutex);29static DEFINE_MUTEX(pid_caches_mutex);
kernel/sched/core.c+1−0
@@ -57,6 +57,7 @@ · 56 unmodified lines
57#include <linux/profile.h>57#include <linux/profile.h>
58#include <linux/psi.h>58#include <linux/psi.h>
59#include <linux/rcuwait_api.h>59#include <linux/rcuwait_api.h>
60#include <linux/rseq.h>
60#include <linux/sched/wake_q.h>61#include <linux/sched/wake_q.h>
61#include <linux/scs.h>62#include <linux/scs.h>
62#include <linux/slab.h>63#include <linux/slab.h>
lib/test_rhashtable.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include <linux/kthread.h>16#include <linux/kthread.h>
17#include <linux/module.h>17#include <linux/module.h>
18#include <linux/rcupdate.h>18#include <linux/rcupdate.h>
19#include <linux/rcupdate_wait.h>
19#include <linux/rhashtable.h>20#include <linux/rhashtable.h>
20#include <linux/slab.h>21#include <linux/slab.h>
21#include <linux/sched.h>22#include <linux/sched.h>
mm/filemap.c+1−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
45#include <linux/migrate.h>45#include <linux/migrate.h>
46#include <linux/pipe_fs_i.h>46#include <linux/pipe_fs_i.h>
47#include <linux/splice.h>47#include <linux/splice.h>
48#include <linux/rcupdate_wait.h>
48#include <asm/pgalloc.h>49#include <asm/pgalloc.h>
49#include <asm/tlbflush.h>50#include <asm/tlbflush.h>
50#include "internal.h"51#include "internal.h"
mm/khugepaged.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/userfaultfd_k.h>17#include <linux/userfaultfd_k.h>
18#include <linux/page_idle.h>18#include <linux/page_idle.h>
19#include <linux/page_table_check.h>19#include <linux/page_table_check.h>
20#include <linux/rcupdate_wait.h>
20#include <linux/swapops.h>21#include <linux/swapops.h>
21#include <linux/shmem_fs.h>22#include <linux/shmem_fs.h>
22#include <linux/ksm.h>23#include <linux/ksm.h>
mm/shmem.c+1−0
@@ -79,6 +79,7 @@ static struct vfsmount *shm_mnt __ro_after_init; · 78 unmodified lines
79#include <linux/rmap.h>79#include <linux/rmap.h>
80#include <linux/uuid.h>80#include <linux/uuid.h>
81#include <linux/quotaops.h>81#include <linux/quotaops.h>
82#include <linux/rcupdate_wait.h>
82 83
83#include <linux/uaccess.h>84#include <linux/uaccess.h>
84 85
mm/swapfile.c+1−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
42#include <linux/completion.h>42#include <linux/completion.h>
43#include <linux/suspend.h>43#include <linux/suspend.h>
44#include <linux/zswap.h>44#include <linux/zswap.h>
45#include <linux/plist.h>
45 46
46#include <asm/tlbflush.h>47#include <asm/tlbflush.h>
47#include <linux/swapops.h>48#include <linux/swapops.h>
net/ipv4/fib_trie.c+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
52#include <linux/if_arp.h>52#include <linux/if_arp.h>
53#include <linux/proc_fs.h>53#include <linux/proc_fs.h>
54#include <linux/rcupdate.h>54#include <linux/rcupdate.h>
55#include <linux/rcupdate_wait.h>
55#include <linux/skbuff.h>56#include <linux/skbuff.h>
56#include <linux/netlink.h>57#include <linux/netlink.h>
57#include <linux/init.h>58#include <linux/init.h>
net/netfilter/ipset/ip_set_bitmap_gen.h+2−0
@@ -4,6 +4,8 @@ · 3 unmodified lines
4#ifndef __IP_SET_BITMAP_IP_GEN_H4#ifndef __IP_SET_BITMAP_IP_GEN_H
5#define __IP_SET_BITMAP_IP_GEN_H5#define __IP_SET_BITMAP_IP_GEN_H
6 6
7#include <linux/rcupdate_wait.h>
8
7#define mtype_do_test IPSET_TOKEN(MTYPE, _do_test)9#define mtype_do_test IPSET_TOKEN(MTYPE, _do_test)
8#define mtype_gc_test IPSET_TOKEN(MTYPE, _gc_test)10#define mtype_gc_test IPSET_TOKEN(MTYPE, _gc_test)
9#define mtype_is_filled IPSET_TOKEN(MTYPE, _is_filled)11#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
5#define _IP_SET_HASH_GEN_H5#define _IP_SET_HASH_GEN_H
6 6
7#include <linux/rcupdate.h>7#include <linux/rcupdate.h>
8#include <linux/rcupdate_wait.h>
8#include <linux/jhash.h>9#include <linux/jhash.h>
9#include <linux/types.h>10#include <linux/types.h>
10#include <linux/netfilter/nfnetlink.h>11#include <linux/netfilter/nfnetlink.h>
net/netfilter/ipvs/ip_vs_conn.c+1−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
31#include <linux/seq_file.h>31#include <linux/seq_file.h>
32#include <linux/jhash.h>32#include <linux/jhash.h>
33#include <linux/random.h>33#include <linux/random.h>
34#include <linux/rcupdate_wait.h>
34 35
35#include <net/net_namespace.h>36#include <net/net_namespace.h>
36#include <net/ip_vs.h>37#include <net/ip_vs.h>
net/netfilter/ipvs/ip_vs_est.c+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#include <linux/interrupt.h>21#include <linux/interrupt.h>
22#include <linux/sysctl.h>22#include <linux/sysctl.h>
23#include <linux/list.h>23#include <linux/list.h>
24#include <linux/rcupdate_wait.h>
24 25
25#include <net/ip_vs.h>26#include <net/ip_vs.h>
26 27
security/selinux/hooks.c+1−0
@@ -85,6 +85,7 @@ · 84 unmodified lines
85#include <linux/export.h>85#include <linux/export.h>
86#include <linux/msg.h>86#include <linux/msg.h>
87#include <linux/shm.h>87#include <linux/shm.h>
88#include <uapi/linux/shm.h>
88#include <linux/bpf.h>89#include <linux/bpf.h>
89#include <linux/kernfs.h>90#include <linux/kernfs.h>
90#include <linux/stringhash.h> /* for hashlen_string() */91#include <linux/stringhash.h> /* for hashlen_string() */
security/smack/smack_lsm.c+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
37#include <linux/personality.h>37#include <linux/personality.h>
38#include <linux/msg.h>38#include <linux/msg.h>
39#include <linux/shm.h>39#include <linux/shm.h>
40#include <uapi/linux/shm.h>
40#include <linux/binfmts.h>41#include <linux/binfmts.h>
41#include <linux/parser.h>42#include <linux/parser.h>
42#include <linux/fs_context.h>43#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