diff options
| author | Peter Xu <peterx@redhat.com> | 2019-06-28 06:59:42 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2019-07-07 05:50:03 -0400 |
| commit | 28ef2db8866495150e4260773fead8313f1a5625 (patch) | |
| tree | b5eecff402061ee6fe7cb26b3c9a50543bfc2381 /include/linux/timer.h | |
| parent | dd2cb348613b44f9d948b068775e159aad298599 (diff) | |
timer: Document TIMER_PINNED
The flag hints the user that the pinned timers will always be run on a
static CPU (because that should be what "pinned" means...) but that's
not the truth, at least with the current implementation.
For example, currently if a pinned timer is set up but later mod_timer()
upon the pinned timer is invoked, mod_timer() will still try to queue the
timer on the current processor and migrate the timer if necessary.
Document it a bit with the definition of TIMER_PINNED so that all future
users will use it correctly.
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Link: https://lkml.kernel.org/r/20190628105942.14131-1-peterx@redhat.com
Diffstat (limited to 'include/linux/timer.h')
| -rw-r--r-- | include/linux/timer.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h index 7b066fd38248..282e4f2a532a 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
| @@ -36,19 +36,30 @@ struct timer_list { | |||
| 36 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) | 36 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | /* | 39 | /** |
| 40 | * A deferrable timer will work normally when the system is busy, but | 40 | * @TIMER_DEFERRABLE: A deferrable timer will work normally when the |
| 41 | * will not cause a CPU to come out of idle just to service it; instead, | 41 | * system is busy, but will not cause a CPU to come out of idle just |
| 42 | * the timer will be serviced when the CPU eventually wakes up with a | 42 | * to service it; instead, the timer will be serviced when the CPU |
| 43 | * subsequent non-deferrable timer. | 43 | * eventually wakes up with a subsequent non-deferrable timer. |
| 44 | * | 44 | * |
| 45 | * An irqsafe timer is executed with IRQ disabled and it's safe to wait for | 45 | * @TIMER_IRQSAFE: An irqsafe timer is executed with IRQ disabled and |
| 46 | * the completion of the running instance from IRQ handlers, for example, | 46 | * it's safe to wait for the completion of the running instance from |
| 47 | * by calling del_timer_sync(). | 47 | * IRQ handlers, for example, by calling del_timer_sync(). |
| 48 | * | 48 | * |
| 49 | * Note: The irq disabled callback execution is a special case for | 49 | * Note: The irq disabled callback execution is a special case for |
| 50 | * workqueue locking issues. It's not meant for executing random crap | 50 | * workqueue locking issues. It's not meant for executing random crap |
| 51 | * with interrupts disabled. Abuse is monitored! | 51 | * with interrupts disabled. Abuse is monitored! |
| 52 | * | ||
| 53 | * @TIMER_PINNED: A pinned timer will not be affected by any timer | ||
| 54 | * placement heuristics (like, NOHZ) and will always expire on the CPU | ||
| 55 | * on which the timer was enqueued. | ||
| 56 | * | ||
| 57 | * Note: Because enqueuing of timers can migrate the timer from one | ||
| 58 | * CPU to another, pinned timers are not guaranteed to stay on the | ||
| 59 | * initialy selected CPU. They move to the CPU on which the enqueue | ||
| 60 | * function is invoked via mod_timer() or add_timer(). If the timer | ||
| 61 | * should be placed on a particular CPU, then add_timer_on() has to be | ||
| 62 | * used. | ||
| 52 | */ | 63 | */ |
| 53 | #define TIMER_CPUMASK 0x0003FFFF | 64 | #define TIMER_CPUMASK 0x0003FFFF |
| 54 | #define TIMER_MIGRATING 0x00040000 | 65 | #define TIMER_MIGRATING 0x00040000 |
