Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-25 Thread Mathieu Desnoyers
- On Sep 25, 2017, at 8:25 AM, Peter Zijlstra pet...@infradead.org wrote: > On Mon, Sep 25, 2017 at 08:10:54PM +0800, Boqun Feng wrote: >> > static void membarrier_register_private_expedited(void) >> > { >> > struct task_struct *p = current; >> > >> > if (READ_ONCE(p->mm->memb

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-25 Thread Peter Zijlstra
On Mon, Sep 25, 2017 at 08:10:54PM +0800, Boqun Feng wrote: > > static void membarrier_register_private_expedited(void) > > { > > struct task_struct *p = current; > > > > if (READ_ONCE(p->mm->membarrier_private_expedited)) > > return; > > membarrier_arch_reg

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-25 Thread Boqun Feng
On Sun, Sep 24, 2017 at 02:23:04PM +, Mathieu Desnoyers wrote: [...] > >> > >> copy_mm() is performed without holding current->sighand->siglock, so > >> it appears to be racing with concurrent membarrier register cmd. > > > > Speak of racing, I think we currently have a problem if we do a > >

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-24 Thread Mathieu Desnoyers
- On Sep 24, 2017, at 9:30 AM, Boqun Feng boqun.f...@gmail.com wrote: > On Fri, Sep 22, 2017 at 03:10:10PM +, Mathieu Desnoyers wrote: >> - On Sep 22, 2017, at 4:59 AM, Boqun Feng boqun.f...@gmail.com wrote: >> >> > On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: >>

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-24 Thread Boqun Feng
On Fri, Sep 22, 2017 at 03:10:10PM +, Mathieu Desnoyers wrote: > - On Sep 22, 2017, at 4:59 AM, Boqun Feng boqun.f...@gmail.com wrote: > > > On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: > > [...] > >> +static inline void membarrier_arch_sched_in(struct task_struct *pr

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-22 Thread Mathieu Desnoyers
- On Sep 22, 2017, at 4:59 AM, Boqun Feng boqun.f...@gmail.com wrote: > On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: > [...] >> +static inline void membarrier_arch_sched_in(struct task_struct *prev, >> +struct task_struct *next) >> +{ >> +/* >> + * Onl

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-22 Thread Boqun Feng
On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: [...] > +static inline void membarrier_arch_sched_in(struct task_struct *prev, > + struct task_struct *next) > +{ > + /* > + * Only need the full barrier when switching between processes. > + */ > + if

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-22 Thread Boqun Feng
On Fri, Sep 22, 2017 at 10:24:41AM +0200, Peter Zijlstra wrote: > On Fri, Sep 22, 2017 at 11:22:06AM +0800, Boqun Feng wrote: > > > The idea is in membarrier_private_expedited(), we go through all ->curr > > on each CPU and > > > > 1) If it's a userspace task and its ->mm is matched, we send an

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-22 Thread Peter Zijlstra
On Fri, Sep 22, 2017 at 11:22:06AM +0800, Boqun Feng wrote: > The idea is in membarrier_private_expedited(), we go through all ->curr > on each CPU and > > 1)If it's a userspace task and its ->mm is matched, we send an ipi > > 2)If it's a kernel task, we skip > > (Because there w

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-21 Thread Mathieu Desnoyers
- On Sep 21, 2017, at 11:30 PM, Boqun Feng boqun.f...@gmail.com wrote: > On Fri, Sep 22, 2017 at 11:22:06AM +0800, Boqun Feng wrote: >> Hi Mathieu, >> >> On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: >> > Provide a new command allowing processes to register their intent t

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-21 Thread Boqun Feng
On Fri, Sep 22, 2017 at 11:22:06AM +0800, Boqun Feng wrote: > Hi Mathieu, > > On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: > > Provide a new command allowing processes to register their intent to use > > the private expedited command. > > > > This allows PowerPC to skip the

Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-21 Thread Boqun Feng
Hi Mathieu, On Tue, Sep 19, 2017 at 06:13:41PM -0400, Mathieu Desnoyers wrote: > Provide a new command allowing processes to register their intent to use > the private expedited command. > > This allows PowerPC to skip the full memory barrier in switch_mm(), and > only issue the barrier when sche

[RFC PATCH v3 1/2] membarrier: Provide register expedited private command

2017-09-19 Thread Mathieu Desnoyers
Provide a new command allowing processes to register their intent to use the private expedited command. This allows PowerPC to skip the full memory barrier in switch_mm(), and only issue the barrier when scheduling into a task belonging to a process that has registered to use expedited private. P