Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-17 Thread Peter Zijlstra
On Wed, Jan 16, 2019 at 02:17:28PM -0500, Johannes Weiner wrote: > > > Also, you probably want to use atomic_t for g->polling, because we > > > (sadly) have architectures where regular stores and atomic ops don't > > > work 'right'. > > > > Oh, I see. Will do. Thanks! > > Yikes, that's news to m

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-16 Thread Suren Baghdasaryan
On Wed, Jan 16, 2019 at 11:27 AM Johannes Weiner wrote: > > On Wed, Jan 16, 2019 at 02:17:28PM -0500, Johannes Weiner wrote: > > On Wed, Jan 16, 2019 at 09:39:13AM -0800, Suren Baghdasaryan wrote: > > > On Wed, Jan 16, 2019 at 5:24 AM Peter Zijlstra > > > wrote: > > > > > > > > On Mon, Jan 14, 2

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-16 Thread Johannes Weiner
On Wed, Jan 16, 2019 at 02:17:28PM -0500, Johannes Weiner wrote: > On Wed, Jan 16, 2019 at 09:39:13AM -0800, Suren Baghdasaryan wrote: > > On Wed, Jan 16, 2019 at 5:24 AM Peter Zijlstra wrote: > > > > > > On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > > > > For memory orderi

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-16 Thread Johannes Weiner
On Wed, Jan 16, 2019 at 09:39:13AM -0800, Suren Baghdasaryan wrote: > On Wed, Jan 16, 2019 at 5:24 AM Peter Zijlstra wrote: > > > > On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > > > For memory ordering (which Johannes also pointed out) the critical point > > > is: > > > >

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-16 Thread Suren Baghdasaryan
On Wed, Jan 16, 2019 at 5:24 AM Peter Zijlstra wrote: > > On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > > For memory ordering (which Johannes also pointed out) the critical point is: > > > > times[cpu] += delta | if g->polling: > > smp_wmb() |

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-16 Thread Peter Zijlstra
On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > For memory ordering (which Johannes also pointed out) the critical point is: > > times[cpu] += delta | if g->polling: > smp_wmb() | g->polling = polling = 0 > cmpxchg(g->polling, 0, 1) | smp

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-14 Thread Suren Baghdasaryan
On Mon, Jan 14, 2019 at 11:42 AM Johannes Weiner wrote: > > On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > > On Mon, Jan 14, 2019 at 2:22 AM Peter Zijlstra wrote: > > > > > > On Thu, Jan 10, 2019 at 02:07:18PM -0800, Suren Baghdasaryan wrote: > > > > +/* > > > > + * psi_upd

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-14 Thread Johannes Weiner
On Mon, Jan 14, 2019 at 11:30:12AM -0800, Suren Baghdasaryan wrote: > On Mon, Jan 14, 2019 at 2:22 AM Peter Zijlstra wrote: > > > > On Thu, Jan 10, 2019 at 02:07:18PM -0800, Suren Baghdasaryan wrote: > > > +/* > > > + * psi_update_work represents slowpath accounting part while > > > + * psi_group_

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-14 Thread Suren Baghdasaryan
On Mon, Jan 14, 2019 at 2:22 AM Peter Zijlstra wrote: > > On Thu, Jan 10, 2019 at 02:07:18PM -0800, Suren Baghdasaryan wrote: > > +/* > > + * psi_update_work represents slowpath accounting part while > > + * psi_group_change represents hotpath part. > > + * There are two potential races between th

Re: [PATCH v2 5/5] psi: introduce psi monitor

2019-01-14 Thread Peter Zijlstra
On Thu, Jan 10, 2019 at 02:07:18PM -0800, Suren Baghdasaryan wrote: > +/* > + * psi_update_work represents slowpath accounting part while > + * psi_group_change represents hotpath part. > + * There are two potential races between these path: > + * 1. Changes to group->polling when slowpath checks f

[PATCH v2 5/5] psi: introduce psi monitor

2019-01-10 Thread Suren Baghdasaryan
Psi monitor aims to provide a low-latency short-term pressure detection mechanism configurable by users. It allows users to monitor psi metrics growth and trigger events whenever a metric raises above user-defined threshold within user-defined time window. Time window and threshold are both expres