.. | .. |
---|
40 | 40 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) |
---|
41 | 41 | #endif |
---|
42 | 42 | |
---|
43 | | -/* |
---|
44 | | - * A deferrable timer will work normally when the system is busy, but |
---|
45 | | - * will not cause a CPU to come out of idle just to service it; instead, |
---|
46 | | - * the timer will be serviced when the CPU eventually wakes up with a |
---|
47 | | - * subsequent non-deferrable timer. |
---|
| 43 | +/** |
---|
| 44 | + * @TIMER_DEFERRABLE: A deferrable timer will work normally when the |
---|
| 45 | + * system is busy, but will not cause a CPU to come out of idle just |
---|
| 46 | + * to service it; instead, the timer will be serviced when the CPU |
---|
| 47 | + * eventually wakes up with a subsequent non-deferrable timer. |
---|
48 | 48 | * |
---|
49 | | - * An irqsafe timer is executed with IRQ disabled and it's safe to wait for |
---|
50 | | - * the completion of the running instance from IRQ handlers, for example, |
---|
51 | | - * by calling del_timer_sync(). |
---|
| 49 | + * @TIMER_IRQSAFE: An irqsafe timer is executed with IRQ disabled and |
---|
| 50 | + * it's safe to wait for the completion of the running instance from |
---|
| 51 | + * IRQ handlers, for example, by calling del_timer_sync(). |
---|
52 | 52 | * |
---|
53 | 53 | * Note: The irq disabled callback execution is a special case for |
---|
54 | 54 | * workqueue locking issues. It's not meant for executing random crap |
---|
55 | 55 | * with interrupts disabled. Abuse is monitored! |
---|
| 56 | + * |
---|
| 57 | + * @TIMER_PINNED: A pinned timer will not be affected by any timer |
---|
| 58 | + * placement heuristics (like, NOHZ) and will always expire on the CPU |
---|
| 59 | + * on which the timer was enqueued. |
---|
| 60 | + * |
---|
| 61 | + * Note: Because enqueuing of timers can migrate the timer from one |
---|
| 62 | + * CPU to another, pinned timers are not guaranteed to stay on the |
---|
| 63 | + * initialy selected CPU. They move to the CPU on which the enqueue |
---|
| 64 | + * function is invoked via mod_timer() or add_timer(). If the timer |
---|
| 65 | + * should be placed on a particular CPU, then add_timer_on() has to be |
---|
| 66 | + * used. |
---|
56 | 67 | */ |
---|
57 | 68 | #define TIMER_CPUMASK 0x0003FFFF |
---|
58 | 69 | #define TIMER_MIGRATING 0x00040000 |
---|
.. | .. |
---|
60 | 71 | #define TIMER_DEFERRABLE 0x00080000 |
---|
61 | 72 | #define TIMER_PINNED 0x00100000 |
---|
62 | 73 | #define TIMER_IRQSAFE 0x00200000 |
---|
| 74 | +#define TIMER_INIT_FLAGS (TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE) |
---|
63 | 75 | #define TIMER_ARRAYSHIFT 22 |
---|
64 | 76 | #define TIMER_ARRAYMASK 0xFFC00000 |
---|
65 | 77 | |
---|
.. | .. |
---|
157 | 169 | */ |
---|
158 | 170 | static inline int timer_pending(const struct timer_list * timer) |
---|
159 | 171 | { |
---|
160 | | - return timer->entry.pprev != NULL; |
---|
| 172 | + return !hlist_unhashed_lockless(&timer->entry); |
---|
161 | 173 | } |
---|
162 | 174 | |
---|
163 | 175 | extern void add_timer_on(struct timer_list *timer, int cpu); |
---|
.. | .. |
---|
176 | 188 | |
---|
177 | 189 | extern int try_to_del_timer_sync(struct timer_list *timer); |
---|
178 | 190 | |
---|
179 | | -#ifdef CONFIG_SMP |
---|
| 191 | +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT) |
---|
180 | 192 | extern int del_timer_sync(struct timer_list *timer); |
---|
181 | 193 | #else |
---|
182 | 194 | # define del_timer_sync(t) del_timer(t) |
---|
.. | .. |
---|
194 | 206 | |
---|
195 | 207 | extern unsigned int sysctl_timer_migration; |
---|
196 | 208 | int timer_migration_handler(struct ctl_table *table, int write, |
---|
197 | | - void __user *buffer, size_t *lenp, |
---|
198 | | - loff_t *ppos); |
---|
| 209 | + void *buffer, size_t *lenp, loff_t *ppos); |
---|
199 | 210 | #endif |
---|
200 | 211 | |
---|
201 | 212 | unsigned long __round_jiffies(unsigned long j, int cpu); |
---|