lkml.org 
[lkml]   [2014]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/3] time,signal: protect resource use statistics with seqlock
On 08/18/2014 12:44 AM, Mike Galbraith wrote:
> On Sat, 2014-08-16 at 19:50 +0200, Oleg Nesterov wrote:
>> On 08/16, Rik van Riel wrote:
>>>
>>> + do {
>>> + seq = nextseq;
>>> + read_seqbegin_or_lock(&sig->stats_lock, &seq);
>>> + times->utime = sig->utime;
>>> + times->stime = sig->stime;
>>> + times->sum_exec_runtime = sig->sum_sched_runtime;
>>> +
>>> + for_each_thread(tsk, t) {
>>> + task_cputime(t, &utime, &stime);
>>> + times->utime += utime;
>>> + times->stime += stime;
>>> + times->sum_exec_runtime += task_sched_runtime(t);
>>> + }
>>> + /* If lockless access failed, take the lock. */
>>> + nextseq = 1;
>>
>> Yes, thanks, this answers my concerns.
>>
>> Cough... can't resist, and I still think that we should take rcu_read_lock()
>> only around for_each_thread() and the patch expands the critical section for
>> no reason. But this is minor, I won't insist.
>
> Hm. Should traversal not also disable preemption to preserve the error
> bound Peter mentioned?

The second traversal takes the spinlock, which automatically
disables preemption.



\
 
 \ /
  Last update: 2014-08-18 16:21    [W:0.144 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site