mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Krzysztof Opasiak <k.opasiak@samsung.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] time: posix: Use dedicated helper to access rlimit values
Date: Fri, 18 Aug 2017 12:46:31 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1708181246020.1929@nanos> (raw)
In-Reply-To: <20170705172548.7911-1-k.opasiak@samsung.com>

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 <k.opasiak@samsung.com>
> ---
>  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

  reply	other threads:[~2017-08-18 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170705172556epcas1p2ee555e8bfc7ac8b3d37efc2728456ad6@epcas1p2.samsung.com>
2017-07-05 17:25 ` Krzysztof Opasiak
2017-08-18 10:46   ` Thomas Gleixner [this message]
2017-08-20  9:57   ` [tip:timers/core] posix-cpu-timers: " tip-bot for Krzysztof Opasiak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1708181246020.1929@nanos \
    --to=tglx@linutronix.de \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome