diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-17 15:35:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-17 15:35:15 -0400 |
commit | 7f2444d38f6bbfa12bc15e2533d8f9daa85ca02b (patch) | |
tree | 6506ec79036890edfd9797b001391a350b5ac10f /kernel/time/tick-sched.c | |
parent | c5f12fdb8bd873aa3ffdb79512e6bdac92b257b0 (diff) | |
parent | 77b4b5420422fc037d00b8f3f0e89b2262e4ae29 (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core timer updates from Thomas Gleixner:
"Timers and timekeeping updates:
- A large overhaul of the posix CPU timer code which is a preparation
for moving the CPU timer expiry out into task work so it can be
properly accounted on the task/process.
An update to the bogus permission checks will come later during the
merge window as feedback was not complete before heading of for
travel.
- Switch the timerqueue code to use cached rbtrees and get rid of the
homebrewn caching of the leftmost node.
- Consolidate hrtimer_init() + hrtimer_init_sleeper() calls into a
single function
- Implement the separation of hrtimers to be forced to expire in hard
interrupt context even when PREEMPT_RT is enabled and mark the
affected timers accordingly.
- Implement a mechanism for hrtimers and the timer wheel to protect
RT against priority inversion and live lock issues when a (hr)timer
which should be canceled is currently executing the callback.
Instead of infinitely spinning, the task which tries to cancel the
timer blocks on a per cpu base expiry lock which is held and
released by the (hr)timer expiry code.
- Enable the Hyper-V TSC page based sched_clock for Hyper-V guests
resulting in faster access to timekeeping functions.
- Updates to various clocksource/clockevent drivers and their device
tree bindings.
- The usual small improvements all over the place"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits)
posix-cpu-timers: Fix permission check regression
posix-cpu-timers: Always clear head pointer on dequeue
hrtimer: Add a missing bracket and hide `migration_base' on !SMP
posix-cpu-timers: Make expiry_active check actually work correctly
posix-timers: Unbreak CONFIG_POSIX_TIMERS=n build
tick: Mark sched_timer to expire in hard interrupt context
hrtimer: Add kernel doc annotation for HRTIMER_MODE_HARD
x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n
posix-cpu-timers: Utilize timerqueue for storage
posix-cpu-timers: Move state tracking to struct posix_cputimers
posix-cpu-timers: Deduplicate rlimit handling
posix-cpu-timers: Remove pointless comparisons
posix-cpu-timers: Get rid of 64bit divisions
posix-cpu-timers: Consolidate timer expiry further
posix-cpu-timers: Get rid of zero checks
rlimit: Rewrite non-sensical RLIMIT_CPU comment
posix-cpu-timers: Respect INFINITY for hard RTTIME limit
posix-cpu-timers: Switch thread group sampling to array
posix-cpu-timers: Restructure expiry array
posix-cpu-timers: Remove cputime_expires
...
Diffstat (limited to 'kernel/time/tick-sched.c')
-rw-r--r-- | kernel/time/tick-sched.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index be9707f68024..955851748dc3 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -634,10 +634,12 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now) | |||
634 | /* Forward the time to expire in the future */ | 634 | /* Forward the time to expire in the future */ |
635 | hrtimer_forward(&ts->sched_timer, now, tick_period); | 635 | hrtimer_forward(&ts->sched_timer, now, tick_period); |
636 | 636 | ||
637 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) | 637 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
638 | hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED); | 638 | hrtimer_start_expires(&ts->sched_timer, |
639 | else | 639 | HRTIMER_MODE_ABS_PINNED_HARD); |
640 | } else { | ||
640 | tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); | 641 | tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); |
642 | } | ||
641 | 643 | ||
642 | /* | 644 | /* |
643 | * Reset to make sure next tick stop doesn't get fooled by past | 645 | * Reset to make sure next tick stop doesn't get fooled by past |
@@ -802,7 +804,8 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu) | |||
802 | } | 804 | } |
803 | 805 | ||
804 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { | 806 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
805 | hrtimer_start(&ts->sched_timer, tick, HRTIMER_MODE_ABS_PINNED); | 807 | hrtimer_start(&ts->sched_timer, tick, |
808 | HRTIMER_MODE_ABS_PINNED_HARD); | ||
806 | } else { | 809 | } else { |
807 | hrtimer_set_expires(&ts->sched_timer, tick); | 810 | hrtimer_set_expires(&ts->sched_timer, tick); |
808 | tick_program_event(tick, 1); | 811 | tick_program_event(tick, 1); |
@@ -1230,7 +1233,7 @@ static void tick_nohz_switch_to_nohz(void) | |||
1230 | * Recycle the hrtimer in ts, so we can share the | 1233 | * Recycle the hrtimer in ts, so we can share the |
1231 | * hrtimer_forward with the highres code. | 1234 | * hrtimer_forward with the highres code. |
1232 | */ | 1235 | */ |
1233 | hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 1236 | hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); |
1234 | /* Get the next period */ | 1237 | /* Get the next period */ |
1235 | next = tick_init_jiffy_update(); | 1238 | next = tick_init_jiffy_update(); |
1236 | 1239 | ||
@@ -1327,7 +1330,7 @@ void tick_setup_sched_timer(void) | |||
1327 | /* | 1330 | /* |
1328 | * Emulate tick processing via per-CPU hrtimers: | 1331 | * Emulate tick processing via per-CPU hrtimers: |
1329 | */ | 1332 | */ |
1330 | hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 1333 | hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); |
1331 | ts->sched_timer.function = tick_sched_timer; | 1334 | ts->sched_timer.function = tick_sched_timer; |
1332 | 1335 | ||
1333 | /* Get the next period (per-CPU) */ | 1336 | /* Get the next period (per-CPU) */ |
@@ -1342,7 +1345,7 @@ void tick_setup_sched_timer(void) | |||
1342 | } | 1345 | } |
1343 | 1346 | ||
1344 | hrtimer_forward(&ts->sched_timer, now, tick_period); | 1347 | hrtimer_forward(&ts->sched_timer, now, tick_period); |
1345 | hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED); | 1348 | hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED_HARD); |
1346 | tick_nohz_activate(ts, NOHZ_MODE_HIGHRES); | 1349 | tick_nohz_activate(ts, NOHZ_MODE_HIGHRES); |
1347 | } | 1350 | } |
1348 | #endif /* HIGH_RES_TIMERS */ | 1351 | #endif /* HIGH_RES_TIMERS */ |