Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-15 Thread Will Deacon
Hi Matthew, On Tue, Feb 13, 2018 at 07:16:08AM -0800, Matthew Wilcox wrote: > On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > > This patch resolves the livelock by not taking hlist_bl_lock in > > d_alloc_parallel if the sequence counter is odd, since any subsequent > > masked

Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-15 Thread Will Deacon
Hi Matthew, On Tue, Feb 13, 2018 at 07:16:08AM -0800, Matthew Wilcox wrote: > On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > > This patch resolves the livelock by not taking hlist_bl_lock in > > d_alloc_parallel if the sequence counter is odd, since any subsequent > > masked

Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Matthew Wilcox
On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > This patch resolves the livelock by not taking hlist_bl_lock in > d_alloc_parallel if the sequence counter is odd, since any subsequent > masked comparison with i_dir_seq will fail anyway. > > Cc: Peter Zijlstra

Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Matthew Wilcox
On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > This patch resolves the livelock by not taking hlist_bl_lock in > d_alloc_parallel if the sequence counter is odd, since any subsequent > masked comparison with i_dir_seq will fail anyway. > > Cc: Peter Zijlstra > Cc: Al Viro >

Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Peter Zijlstra
On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > If d_alloc_parallel runs concurrently with __d_add, it is possible for > d_alloc_parallel to continuously retry whilst i_dir_seq has been > incremented to an odd value by __d_add: > > CPU0: > __d_add > n = start_dir_add(dir); >

Re: [PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Peter Zijlstra
On Tue, Feb 13, 2018 at 12:58:51PM +, Will Deacon wrote: > If d_alloc_parallel runs concurrently with __d_add, it is possible for > d_alloc_parallel to continuously retry whilst i_dir_seq has been > incremented to an odd value by __d_add: > > CPU0: > __d_add > n = start_dir_add(dir); >

[PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Will Deacon
If d_alloc_parallel runs concurrently with __d_add, it is possible for d_alloc_parallel to continuously retry whilst i_dir_seq has been incremented to an odd value by __d_add: CPU0: __d_add n = start_dir_add(dir); cmpxchg(>i_dir_seq, n, n + 1) == n CPU1: d_alloc_parallel

[PATCH] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add

2018-02-13 Thread Will Deacon
If d_alloc_parallel runs concurrently with __d_add, it is possible for d_alloc_parallel to continuously retry whilst i_dir_seq has been incremented to an odd value by __d_add: CPU0: __d_add n = start_dir_add(dir); cmpxchg(>i_dir_seq, n, n + 1) == n CPU1: d_alloc_parallel