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

Configure Feed

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

posix-cpu-timers: Split out posix-timers_types.h

Trimming down sched.h dependencies: we don't want to include more than
the base types.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+84 -67
+3 -66
include/linux/posix-timers.h
··· 2 2 #ifndef _linux_POSIX_TIMERS_H 3 3 #define _linux_POSIX_TIMERS_H 4 4 5 - #include <linux/spinlock.h> 5 + #include <linux/alarmtimer.h> 6 6 #include <linux/list.h> 7 7 #include <linux/mutex.h> 8 - #include <linux/alarmtimer.h> 8 + #include <linux/posix-timers_types.h> 9 + #include <linux/spinlock.h> 9 10 #include <linux/timerqueue.h> 10 11 11 12 struct kernel_siginfo; 12 13 struct task_struct; 13 - 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 14 39 15 static inline clockid_t make_process_cpuclock(const unsigned int pid, 40 16 const clockid_t clock) ··· 85 109 ctmr->node.expires = exp; 86 110 } 87 111 88 - /** 89 - * posix_cputimer_base - Container per posix CPU clock 90 - * @nextevt: Earliest-expiration cache 91 - * @tqhead: timerqueue head for cpu_timers 92 - */ 93 - struct posix_cputimer_base { 94 - u64 nextevt; 95 - struct timerqueue_head tqhead; 96 - }; 97 - 98 - /** 99 - * posix_cputimers - Container for posix CPU timer related data 100 - * @bases: Base container for posix CPU clocks 101 - * @timers_active: Timers are queued. 102 - * @expiry_active: Timer expiry is active. Used for 103 - * process wide timers to avoid multiple 104 - * task trying to handle expiry concurrently 105 - * 106 - * Used in task_struct and signal_struct 107 - */ 108 - struct posix_cputimers { 109 - struct posix_cputimer_base bases[CPUCLOCK_MAX]; 110 - unsigned int timers_active; 111 - unsigned int expiry_active; 112 - }; 113 - 114 - /** 115 - * posix_cputimers_work - Container for task work based posix CPU timer expiry 116 - * @work: The task work to be scheduled 117 - * @mutex: Mutex held around expiry in context of this task work 118 - * @scheduled: @work has been scheduled already, no further processing 119 - */ 120 - struct posix_cputimers_work { 121 - struct callback_head work; 122 - struct mutex mutex; 123 - unsigned int scheduled; 124 - }; 125 - 126 112 static inline void posix_cputimers_init(struct posix_cputimers *pct) 127 113 { 128 114 memset(pct, 0, sizeof(*pct)); ··· 117 179 .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \ 118 180 }, 119 181 #else 120 - struct posix_cputimers { }; 121 182 struct cpu_timer { }; 122 183 #define INIT_CPU_TIMERS(s) 123 184 static inline void posix_cputimers_init(struct posix_cputimers *pct) { }
+80
include/linux/posix-timers_types.h
··· 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.h> 7 + #include <linux/types.h> 8 + 9 + /* 10 + * Bit fields within a clockid: 11 + * 12 + * The most significant 29 bits hold either a pid or a file descriptor. 13 + * 14 + * Bit 2 indicates whether a cpu clock refers to a thread or a process. 15 + * 16 + * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3. 17 + * 18 + * A clockid is invalid if bits 2, 1, and 0 are all set. 19 + */ 20 + #define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) 21 + #define CPUCLOCK_PERTHREAD(clock) \ 22 + (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) 23 + 24 + #define CPUCLOCK_PERTHREAD_MASK 4 25 + #define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) 26 + #define CPUCLOCK_CLOCK_MASK 3 27 + #define CPUCLOCK_PROF 0 28 + #define CPUCLOCK_VIRT 1 29 + #define CPUCLOCK_SCHED 2 30 + #define CPUCLOCK_MAX 3 31 + #define CLOCKFD CPUCLOCK_MAX 32 + #define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK) 33 + 34 + #ifdef CONFIG_POSIX_TIMERS 35 + 36 + /** 37 + * posix_cputimer_base - Container per posix CPU clock 38 + * @nextevt: Earliest-expiration cache 39 + * @tqhead: timerqueue head for cpu_timers 40 + */ 41 + struct posix_cputimer_base { 42 + u64 nextevt; 43 + struct timerqueue_head tqhead; 44 + }; 45 + 46 + /** 47 + * posix_cputimers - Container for posix CPU timer related data 48 + * @bases: Base container for posix CPU clocks 49 + * @timers_active: Timers are queued. 50 + * @expiry_active: Timer expiry is active. Used for 51 + * process wide timers to avoid multiple 52 + * task trying to handle expiry concurrently 53 + * 54 + * Used in task_struct and signal_struct 55 + */ 56 + struct posix_cputimers { 57 + struct posix_cputimer_base bases[CPUCLOCK_MAX]; 58 + unsigned int timers_active; 59 + unsigned int expiry_active; 60 + }; 61 + 62 + /** 63 + * posix_cputimers_work - Container for task work based posix CPU timer expiry 64 + * @work: The task work to be scheduled 65 + * @mutex: Mutex held around expiry in context of this task work 66 + * @scheduled: @work has been scheduled already, no further processing 67 + */ 68 + struct posix_cputimers_work { 69 + struct callback_head work; 70 + struct mutex mutex; 71 + unsigned int scheduled; 72 + }; 73 + 74 + #else /* CONFIG_POSIX_TIMERS */ 75 + 76 + struct posix_cputimers { }; 77 + 78 + #endif /* CONFIG_POSIX_TIMERS */ 79 + 80 + #endif /* _linux_POSIX_TIMERS_TYPES_H */
+1 -1
include/linux/sched.h
··· 31 31 #include <linux/syscall_user_dispatch.h> 32 32 #include <linux/mm_types_task.h> 33 33 #include <linux/task_io_accounting.h> 34 - #include <linux/posix-timers.h> 34 + #include <linux/posix-timers_types.h> 35 35 #include <linux/rseq.h> 36 36 #include <linux/seqlock.h> 37 37 #include <linux/kcsan.h>