From: Rik van Riel <riel@redhat.com>
To: Mike Galbraith <umgwanakikbuti@gmail.com>,
Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
fweisbec@gmail.com, akpm@linux-foundation.org, srao@redhat.com,
lwoodman@redhat.com, atheurer@redhat.com
Subject: Re: [PATCH v2 2/3] time,signal: protect resource use statistics with seqlock
Date: Mon, 18 Aug 2014 10:03:32 -0400 [thread overview]
Message-ID: <53F207B4.6070908@redhat.com> (raw)
In-Reply-To: <1408337089.5570.16.camel@marge.simpson.net>
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.
next prev parent reply other threads:[~2014-08-18 14:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-15 20:05 [PATCH 0/3] lockless sys_times and posix_cpu_clock_get riel
2014-08-15 20:05 ` [PATCH 1/3] exit: always reap resource stats in __exit_signal riel
2014-09-08 6:39 ` [tip:sched/core] exit: Always reap resource stats in __exit_signal() tip-bot for Rik van Riel
2014-08-15 20:05 ` [PATCH 2/3] time,signal: protect resource use statistics with seqlock riel
2014-08-16 14:11 ` Oleg Nesterov
2014-08-16 15:07 ` Rik van Riel
2014-08-16 17:40 ` [PATCH v2 " Rik van Riel
2014-08-16 17:50 ` Oleg Nesterov
2014-08-18 4:44 ` Mike Galbraith
2014-08-18 14:03 ` Rik van Riel [this message]
2014-08-19 14:26 ` Mike Galbraith
2014-09-08 6:39 ` [tip:sched/core] time, signal: Protect " tip-bot for Rik van Riel
2014-08-15 20:05 ` [PATCH 3/3] sched,time: atomically increment stime & utime riel
2014-08-16 14:55 ` Oleg Nesterov
2014-08-16 14:56 ` Oleg Nesterov
2014-09-08 6:40 ` [tip:sched/core] sched, time: Atomically " tip-bot for Rik van Riel
2014-08-19 21:21 ` [PATCH 0/3] lockless sys_times and posix_cpu_clock_get Andrew Theurer
2014-09-03 18:38 ` Rik van Riel
2014-09-04 7:48 ` Peter Zijlstra
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=53F207B4.6070908@redhat.com \
--to=riel@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=atheurer@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lwoodman@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=srao@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.