aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/posix-cpu-timers.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 16:06:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 16:06:34 -0400
commitdd90cccffc20a15d8e4c3ac8813f4b6a6cd4766f (patch)
treeb870506b456e3b965638035abb0b2c944b024fd9 /kernel/time/posix-cpu-timers.c
parentb1b6f83ac938d176742c85757960dec2cf10e468 (diff)
parent51218298a25e6942957c5595f2abf130d47d5df9 (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "A rather small update for the time(r) subsystem: - A new clocksource driver IMX-TPM - Minor fixes to the alarmtimer facility - Device tree cleanups for Renesas drivers - A new kselftest and fixes for the timer related tests - Conversion of the clocksource drivers to use %pOF - Use the proper helpers to access rlimits in the posix-cpu-timer code" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: alarmtimer: Ensure RTC module is not unloaded clocksource: Convert to using %pOF instead of full_name clocksource/drivers/bcm2835: Remove message for a memory allocation failure devicetree: bindings: Remove deprecated properties devicetree: bindings: Remove unused 32-bit CMT bindings devicetree: bindings: Deprecate property, update example devicetree: bindings: r8a73a4 and R-Car Gen2 CMT bindings devicetree: bindings: R-Car Gen2 CMT0 and CMT1 bindings devicetree: bindings: Remove sh7372 CMT binding clocksource/drivers/imx-tpm: Add imx tpm timer support dt-bindings: timer: Add nxp tpm timer binding doc posix-cpu-timers: Use dedicated helper to access rlimit values alarmtimer: Fix unavailable wake-up source in sysfs timekeeping: Use proper timekeeper for debug code kselftests: timers: set-timer-lat: Add one-shot timer test cases kselftests: timers: set-timer-lat: Tweak reporting when timer fires early kselftests: timers: freq-step: Fix build warning kselftests: timers: freq-step: Define ADJ_SETOFFSET if device has older kernel headers
Diffstat (limited to 'kernel/time/posix-cpu-timers.c')
-rw-r--r--kernel/time/posix-cpu-timers.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index a3bd5dbe0dc4..8585ad6e472a 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -799,7 +799,6 @@ static void check_thread_timers(struct task_struct *tsk,
799 struct list_head *firing) 799 struct list_head *firing)
800{ 800{
801 struct list_head *timers = tsk->cpu_timers; 801 struct list_head *timers = tsk->cpu_timers;
802 struct signal_struct *const sig = tsk->signal;
803 struct task_cputime *tsk_expires = &tsk->cputime_expires; 802 struct task_cputime *tsk_expires = &tsk->cputime_expires;
804 u64 expires; 803 u64 expires;
805 unsigned long soft; 804 unsigned long soft;
@@ -823,10 +822,9 @@ static void check_thread_timers(struct task_struct *tsk,
823 /* 822 /*
824 * Check for the special case thread timers. 823 * Check for the special case thread timers.
825 */ 824 */
826 soft = READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_cur); 825 soft = task_rlimit(tsk, RLIMIT_RTTIME);
827 if (soft != RLIM_INFINITY) { 826 if (soft != RLIM_INFINITY) {
828 unsigned long hard = 827 unsigned long hard = task_rlimit_max(tsk, RLIMIT_RTTIME);
829 READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_max);
830 828
831 if (hard != RLIM_INFINITY && 829 if (hard != RLIM_INFINITY &&
832 tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { 830 tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) {
@@ -847,7 +845,8 @@ static void check_thread_timers(struct task_struct *tsk,
847 */ 845 */
848 if (soft < hard) { 846 if (soft < hard) {
849 soft += USEC_PER_SEC; 847 soft += USEC_PER_SEC;
850 sig->rlim[RLIMIT_RTTIME].rlim_cur = soft; 848 tsk->signal->rlim[RLIMIT_RTTIME].rlim_cur =
849 soft;
851 } 850 }
852 if (print_fatal_signals) { 851 if (print_fatal_signals) {
853 pr_info("RT Watchdog Timeout (soft): %s[%d]\n", 852 pr_info("RT Watchdog Timeout (soft): %s[%d]\n",
@@ -938,11 +937,10 @@ static void check_process_timers(struct task_struct *tsk,
938 SIGPROF); 937 SIGPROF);
939 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime, 938 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime,
940 SIGVTALRM); 939 SIGVTALRM);
941 soft = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); 940 soft = task_rlimit(tsk, RLIMIT_CPU);
942 if (soft != RLIM_INFINITY) { 941 if (soft != RLIM_INFINITY) {
943 unsigned long psecs = div_u64(ptime, NSEC_PER_SEC); 942 unsigned long psecs = div_u64(ptime, NSEC_PER_SEC);
944 unsigned long hard = 943 unsigned long hard = task_rlimit_max(tsk, RLIMIT_CPU);
945 READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_max);
946 u64 x; 944 u64 x;
947 if (psecs >= hard) { 945 if (psecs >= hard) {
948 /* 946 /*