From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751027AbdHRKqf (ORCPT ); Fri, 18 Aug 2017 06:46:35 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41476 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750709AbdHRKqd (ORCPT ); Fri, 18 Aug 2017 06:46:33 -0400 Date: Fri, 18 Aug 2017 12:46:31 +0200 (CEST) From: Thomas Gleixner To: Krzysztof Opasiak cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] time: posix: Use dedicated helper to access rlimit values In-Reply-To: <20170705172548.7911-1-k.opasiak@samsung.com> Message-ID: References: <20170705172548.7911-1-k.opasiak@samsung.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Jul 2017, Krzysztof Opasiak wrote: > Use rlimit() and rlimit_max() helper instead of manually writing > whole chain from task to rlimit value > > Signed-off-by: Krzysztof Opasiak > --- > kernel/time/posix-cpu-timers.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c > index d2a1e6dd0291..51b548c10959 100644 > --- a/kernel/time/posix-cpu-timers.c > +++ b/kernel/time/posix-cpu-timers.c > @@ -790,7 +790,6 @@ static void check_thread_timers(struct task_struct *tsk, > struct list_head *firing) > { > struct list_head *timers = tsk->cpu_timers; > - struct signal_struct *const sig = tsk->signal; > struct task_cputime *tsk_expires = &tsk->cputime_expires; > u64 expires; > unsigned long soft; > @@ -814,10 +813,9 @@ static void check_thread_timers(struct task_struct *tsk, > /* > * Check for the special case thread timers. > */ > - soft = READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_cur); > + soft = task_rlimit(tsk, RLIMIT_RTTIME); > if (soft != RLIM_INFINITY) { > - unsigned long hard = > - READ_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_max); > + unsigned long hard = task_rlimit_max(tsk, RLIMIT_RTTIME); > > if (hard != RLIM_INFINITY && > tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { > @@ -838,7 +836,8 @@ static void check_thread_timers(struct task_struct *tsk, > */ > if (soft < hard) { > soft += USEC_PER_SEC; > - sig->rlim[RLIMIT_RTTIME].rlim_cur = soft; > + tsk->signal->rlim[RLIMIT_RTTIME].rlim_cur = > + soft; Can you please create a helper for that as well? Thanks, tglx