[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140814004318.GA2582@lerouge>
Date: Thu, 14 Aug 2014 02:43:21 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Rik van Riel <riel@...hat.com>
Cc: Oleg Nesterov <oleg@...hat.com>, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.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,signal: protect resource use statistics with
seqlock
On Wed, Aug 13, 2014 at 05:03:24PM -0400, Rik van Riel wrote:
> --- a/kernel/time/posix-cpu-timers.c
> +++ b/kernel/time/posix-cpu-timers.c
> @@ -272,22 +272,8 @@ static int posix_cpu_clock_get_task(struct task_struct *tsk,
> if (same_thread_group(tsk, current))
> err = cpu_clock_sample(which_clock, tsk, &rtn);
> } else {
> - unsigned long flags;
> - struct sighand_struct *sighand;
> -
> - /*
> - * while_each_thread() is not yet entirely RCU safe,
> - * keep locking the group while sampling process
> - * clock for now.
> - */
> - sighand = lock_task_sighand(tsk, &flags);
> - if (!sighand)
> - return err;
> -
> if (tsk == current || thread_group_leader(tsk))
> err = cpu_clock_sample_group(which_clock, tsk, &rtn);
> -
> - unlock_task_sighand(tsk, &flags);
> }
I'm worried about such lockless solution based on RCU or read seqcount because
we lose the guarantee that an update is immediately visible by all subsequent
readers.
Say CPU 0 updates the thread time and both CPU 1 and CPU 2 right after that
call clock_gettime(), with the spinlock we were guaranteed to see the new
update. Now with a pure seqlock read approach, we guarantee a
read sequence coherency but we don't guarantee the freshest update result.
So that looks like a source of non monotonic results.
>
> if (!err)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists