posix-cpu-timers: Use dedicated helper to access rlimit values

Use rlimit() and rlimit_max() helper instead of manually writing
whole chain from task to rlimit value

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170705172548.7911-1-k.opasiak@samsung.com

authored by

Krzysztof Opasiak and committed by
Thomas Gleixner
3cf29496 ef954844

+6 -8
+6 -8
kernel/time/posix-cpu-timers.c
··· 799 799 struct list_head *firing) 800 800 { 801 801 struct list_head *timers = tsk->cpu_timers; 802 - struct signal_struct *const sig = tsk->signal; 803 802 struct task_cputime *tsk_expires = &tsk->cputime_expires; 804 803 u64 expires; 805 804 unsigned long soft; ··· 822 823 /* 823 824 * Check for the special case thread timers. 824 825 */ 825 - soft = READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_cur); 826 + soft = task_rlimit(tsk, RLIMIT_RTTIME); 826 827 if (soft != RLIM_INFINITY) { 827 - unsigned long hard = 828 - READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_max); 828 + unsigned long hard = task_rlimit_max(tsk, RLIMIT_RTTIME); 829 829 830 830 if (hard != RLIM_INFINITY && 831 831 tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { ··· 845 847 */ 846 848 if (soft < hard) { 847 849 soft += USEC_PER_SEC; 848 - sig->rlim[RLIMIT_RTTIME].rlim_cur = soft; 850 + tsk->signal->rlim[RLIMIT_RTTIME].rlim_cur = 851 + soft; 849 852 } 850 853 if (print_fatal_signals) { 851 854 pr_info("RT Watchdog Timeout (soft): %s[%d]\n", ··· 937 938 SIGPROF); 938 939 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime, 939 940 SIGVTALRM); 940 - soft = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); 941 + soft = task_rlimit(tsk, RLIMIT_CPU); 941 942 if (soft != RLIM_INFINITY) { 942 943 unsigned long psecs = div_u64(ptime, NSEC_PER_SEC); 943 - unsigned long hard = 944 - READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_max); 944 + unsigned long hard = task_rlimit_max(tsk, RLIMIT_CPU); 945 945 u64 x; 946 946 if (psecs >= hard) { 947 947 /*