Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
On 08/16, Frederic Weisbecker wrote: > > On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: > > > > Unless I missread this patch, this is still racy a bit. > > > > Suppose it is called on CPU_0 and cpu == 1. Suppose that > > ts->idle_active == T and nr_iowait_cpu(cpu) == 1. > > > > So

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
2013/8/16 Frederic Weisbecker : > On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: >> Thanks Frederic! >> >> I'll try to read this series carefully later. Not that I think >> I can help, you certainly understand this much better. >> >> Just one question below, >> >> On 08/16,

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
On 08/16, Frederic Weisbecker wrote: > > On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: > > > + do { > > > + seq = read_seqcount_begin(>sleeptime_seq); > > > + if (ts->idle_active && nr_iowait_cpu(cpu) > 0) { > > > + ktime_t delta = ktime_sub(now,

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: > Thanks Frederic! > > I'll try to read this series carefully later. Not that I think > I can help, you certainly understand this much better. > > Just one question below, > > On 08/16, Frederic Weisbecker wrote: > > > > @@ -499,12

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: > Thanks Frederic! > > I'll try to read this series carefully later. Not that I think > I can help, you certainly understand this much better. > > Just one question below, > > On 08/16, Frederic Weisbecker wrote: > > > > @@ -499,12

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
Thanks Frederic! I'll try to read this series carefully later. Not that I think I can help, you certainly understand this much better. Just one question below, On 08/16, Frederic Weisbecker wrote: > > @@ -499,12 +509,15 @@ u64 get_cpu_iowait_time_us(int cpu, u64 > *last_update_time) > if

[PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
When some call site uses get_cpu_*_time_us() to read a sleeptime stat, it deduces the total sleeptime by adding the pending time to the last sleeptime snapshot if the CPU target is idle. Namely this sums up to: sleeptime = ts($CPU)->idle_sleeptime; if (ts($CPU)->idle_active)

[PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
When some call site uses get_cpu_*_time_us() to read a sleeptime stat, it deduces the total sleeptime by adding the pending time to the last sleeptime snapshot if the CPU target is idle. Namely this sums up to: sleeptime = ts($CPU)-idle_sleeptime; if (ts($CPU)-idle_active)

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
Thanks Frederic! I'll try to read this series carefully later. Not that I think I can help, you certainly understand this much better. Just one question below, On 08/16, Frederic Weisbecker wrote: @@ -499,12 +509,15 @@ u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time) if

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: Thanks Frederic! I'll try to read this series carefully later. Not that I think I can help, you certainly understand this much better. Just one question below, On 08/16, Frederic Weisbecker wrote: @@ -499,12 +509,15 @@

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: Thanks Frederic! I'll try to read this series carefully later. Not that I think I can help, you certainly understand this much better. Just one question below, On 08/16, Frederic Weisbecker wrote: @@ -499,12 +509,15 @@

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
On 08/16, Frederic Weisbecker wrote: On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: + do { + seq = read_seqcount_begin(ts-sleeptime_seq); + if (ts-idle_active nr_iowait_cpu(cpu) 0) { + ktime_t delta = ktime_sub(now,

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
2013/8/16 Frederic Weisbecker fweis...@gmail.com: On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: Thanks Frederic! I'll try to read this series carefully later. Not that I think I can help, you certainly understand this much better. Just one question below, On 08/16,

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
On 08/16, Frederic Weisbecker wrote: On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: Unless I missread this patch, this is still racy a bit. Suppose it is called on CPU_0 and cpu == 1. Suppose that ts-idle_active == T and nr_iowait_cpu(cpu) == 1. So we return

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:26:54PM +0200, Oleg Nesterov wrote: On 08/16, Frederic Weisbecker wrote: On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: + do { + seq = read_seqcount_begin(ts-sleeptime_seq); + if (ts-idle_active

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:33:55PM +0200, Oleg Nesterov wrote: On 08/16, Frederic Weisbecker wrote: On Fri, Aug 16, 2013 at 06:02:01PM +0200, Oleg Nesterov wrote: Unless I missread this patch, this is still racy a bit. Suppose it is called on CPU_0 and cpu == 1. Suppose that

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Oleg Nesterov
On 08/16, Frederic Weisbecker wrote: tick_nohz_stop_idle() to iowait if we called tick_nohz_start_idle() with nr_iowait 0. All we need is just a new field in ts- that records on which state we entered idle. Or we can turn -idle_active into enum. And all other nr_iowait_cpu's in this code

Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-16 Thread Frederic Weisbecker
On Fri, Aug 16, 2013 at 06:49:22PM +0200, Oleg Nesterov wrote: On 08/16, Frederic Weisbecker wrote: tick_nohz_stop_idle() to iowait if we called tick_nohz_start_idle() with nr_iowait 0. All we need is just a new field in ts- that records on which state we entered idle. Or we can

[PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-08 Thread Frederic Weisbecker
When some call site uses get_cpu_*_time_us() to read a sleeptime stat, it deduces the total sleeptime by adding the pending time to the last sleeptime snapshot if the CPU target is idle. Namely this sums up to: sleeptime = ts($CPU)->idle_sleeptime; if (ts($CPU)->idle_active)

[PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

2013-08-08 Thread Frederic Weisbecker
When some call site uses get_cpu_*_time_us() to read a sleeptime stat, it deduces the total sleeptime by adding the pending time to the last sleeptime snapshot if the CPU target is idle. Namely this sums up to: sleeptime = ts($CPU)-idle_sleeptime; if (ts($CPU)-idle_active)

<    1   2