public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jason Low <jason.low2@hp.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	terry.rudd@hp.com, Rik van Riel <riel@redhat.com>,
	Waiman Long <Waiman.Long@hp.com>,
	Scott J Norton <scott.norton@hp.com>
Subject: Re: [RFC PATCH] timer: Improve itimers scalability
Date: Thu, 6 Aug 2015 16:18:20 +0200	[thread overview]
Message-ID: <20150806141820.GA8258@redhat.com> (raw)
In-Reply-To: <1438734584.2927.15.camel@j-VirtualBox>

On 08/04, Jason Low wrote:
>
> @@ -973,13 +981,6 @@ static void check_process_timers(struct task_struct *tsk,
>  	virt_expires = check_timers_list(++timers, firing, utime);
>  	sched_expires = check_timers_list(++timers, firing, sum_sched_runtime);
>  
> -	/*
> -	 * Check for the special case process timers.
> -	 */
> -	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_PROF], &prof_expires, ptime,
> -			 SIGPROF);
> -	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime,
> -			 SIGVTALRM);
>  	soft = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
>  	if (soft != RLIM_INFINITY) {
>  		unsigned long psecs = cputime_to_secs(ptime);
> @@ -1010,11 +1011,21 @@ static void check_process_timers(struct task_struct *tsk,
>  		}
>  	}
>  
> +	/*
> +	 * Check for the special case process timers.
> +	 */
> +	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_PROF], &prof_expires, ptime,
> +			 SIGPROF);
> +	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime,
> +			 SIGVTALRM);
> +

Not sure I understand this part... looks wrong actually, please note
that RLIMIT_CPU block above may need to update prof_expires _after_
check_cpu_itimer(), or I am totally confused.

>  	if (READ_ONCE(sig->cputimer.running)) {
>  		struct task_cputime group_sample;
>  
> +		/*
> +		 * If another thread in the group is already checking
> +		 * for the thread group cputimer, then we will skip that.
> +		 */
> +		if (READ_ONCE(sig->cputimer.is_checking_timer))
> +			return 0;
> +

Cosmetic, I won't insist, but this is not symmetrical to ->running check,

	if (READ_ONCE(sig->cputimer.running) &&
	    !READ_ONCE(sig->cputimer.is_checking_timer))

looks a littke bit better to me.

Oleg.


  parent reply	other threads:[~2015-08-06 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  0:29 [RFC PATCH] timer: Improve itimers scalability Jason Low
2015-08-05  9:24 ` Peter Zijlstra
2015-08-05  9:37 ` Peter Zijlstra
2015-08-05 19:44   ` Jason Low
2015-08-06 14:18 ` Oleg Nesterov [this message]
2015-08-06 18:21   ` Jason Low
2015-08-07 12:01     ` Oleg Nesterov

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=20150806141820.GA8258@redhat.com \
    --to=oleg@redhat.com \
    --cc=Waiman.Long@hp.com \
    --cc=dave@stgolabs.net \
    --cc=fweisbec@gmail.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=scott.norton@hp.com \
    --cc=terry.rudd@hp.com \
    --cc=umgwanakikbuti@gmail.com \
    /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