[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140813174048.GV9918@twins.programming.kicks-ass.net>
Date: Wed, 13 Aug 2014 19:40:48 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Rik van Riel <riel@...hat.com>, linux-kernel@...r.kernel.org,
Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
Frank Mayhar <fmayhar@...gle.com>,
Frederic Weisbecker <fweisbec@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sanjay Rao <srao@...hat.com>,
Larry Woodman <lwoodman@...hat.com>
Subject: Re: [PATCH RFC] time: drop do_sys_times spinlock
On Wed, Aug 13, 2014 at 07:22:30PM +0200, Oleg Nesterov wrote:
> On 08/12, Rik van Riel wrote:
> >
> > Any other ideas?
>
> To simplify, lets suppose that we only need sum_exec_runtime.
>
> Perhaps we can do something like this
>
> u64 thread_group_sched_runtime(void)
> {
> struct task_struct *tsk = current;
> spinlock_t *siglock = &tsk->sighand->siglock; /* stable */
> struct task_struct *t;
> u64 x1, x2;
>
> retry:
> x1 = tsk->signal->sum_sched_runtime;
> rmb();
> spin_unlock_wait(siglock);
> rmb();
>
> x2 = 0;
> rcu_read_lock();
> for_each_thread(tsk, t)
> x2 += task_sched_runtime(t);
> rcu_read_unlock();
>
> rmb();
> spin_unlock_wait(siglock);
> rmb();
>
> if (x1 != tsk->signal->sum_sched_runtime)
> goto retry;
>
> return x1 + x2;
> }
>
> ?
>
> We do not care if for_each_thread() misses the new thread, we can pretend
> thread_group_sched_runtime() was called before clone.
>
> We do not care if a thread with sum_sched_runtime == 0 exits, obviously.
>
> Otherwise "x1 != tsk->signal->sum_sched_runtime" should tell us that we
> raced with __exit_signal().
So the problem with the above is the lack of fwd progress; if there's
enough clone()/exit() happening in the thread group (and the more CPUs
the more possible), we'll keep repeating.
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists