Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1201793

Re: [RFC PATCH] timer: Improve itimers scalability

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] timer: Improve itimers scalability
Date 2015-08-06 16:30 +0200
Message-ID <pUulc-367-35@gated-at.bofh.it> (permalink)
References <pTUUp-1Rq-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] timer: Improve itimers scalability Jason Low <jason.low2@hp.com> - 2015-08-05 02:40 +0200
  Re: [RFC PATCH] timer: Improve itimers scalability Peter Zijlstra <peterz@infradead.org> - 2015-08-05 11:30 +0200
  Re: [RFC PATCH] timer: Improve itimers scalability Peter Zijlstra <peterz@infradead.org> - 2015-08-05 11:40 +0200
    Re: [RFC PATCH] timer: Improve itimers scalability Jason Low <jason.low2@hp.com> - 2015-08-05 22:00 +0200
  Re: [RFC PATCH] timer: Improve itimers scalability Oleg Nesterov <oleg@redhat.com> - 2015-08-06 16:30 +0200
    Re: [RFC PATCH] timer: Improve itimers scalability Jason Low <jason.low2@hp.com> - 2015-08-06 20:30 +0200
      Re: [RFC PATCH] timer: Improve itimers scalability Oleg Nesterov <oleg@redhat.com> - 2015-08-07 14:10 +0200

csiph-web