Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread 'Thomas Graf'
On 01/13/15 at 03:06pm, David Laight wrote: > OK, ht->mutes saves the day. > Might be worth a comment to save people looking at the code in isolation > from worrying and doing a bit search. > OTOH it might be obvious from a slightly larger fragment than the diff. Good idea. Will do this. Also,

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf ... > > > spin_lock_bh(old_bucket_lock1); > > > - spin_lock_bh_nested(old_bucket_lock2, RHT_LOCK_NESTED); > > > - spin_lock_bh_nested(new_bucket_lock, RHT_LOCK_NESTED2); > > > + > > > + /* Depending on the lock per buckets mapping, the bucket in

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf ... > > Thought, could the shrunk table use the same locks as the lower half > > of the old table? > > No. A new bucket table and thus a new set of locks is allocated when the > table is shrunk or grown. We only have check for overlapping locks > when holding multiple locks for

Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread 'Thomas Graf'
On 01/13/15 at 09:49am, David Laight wrote: > From: Thomas Graf > > Each per bucket lock covers a configurable number of buckets. While > > shrinking, two buckets in the old table contain entries for a single > > bucket in the new table. We need to lock down both while linking. > > Check if they

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf > Each per bucket lock covers a configurable number of buckets. While > shrinking, two buckets in the old table contain entries for a single > bucket in the new table. We need to lock down both while linking. > Check if they are protected by different locks to avoid a recursive >

Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread 'Thomas Graf'
On 01/13/15 at 09:49am, David Laight wrote: From: Thomas Graf Each per bucket lock covers a configurable number of buckets. While shrinking, two buckets in the old table contain entries for a single bucket in the new table. We need to lock down both while linking. Check if they are

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf Each per bucket lock covers a configurable number of buckets. While shrinking, two buckets in the old table contain entries for a single bucket in the new table. We need to lock down both while linking. Check if they are protected by different locks to avoid a recursive

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf ... Thought, could the shrunk table use the same locks as the lower half of the old table? No. A new bucket table and thus a new set of locks is allocated when the table is shrunk or grown. We only have check for overlapping locks when holding multiple locks for the same

RE: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread David Laight
From: Thomas Graf ... spin_lock_bh(old_bucket_lock1); - spin_lock_bh_nested(old_bucket_lock2, RHT_LOCK_NESTED); - spin_lock_bh_nested(new_bucket_lock, RHT_LOCK_NESTED2); + + /* Depending on the lock per buckets mapping, the bucket in + *

Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-13 Thread 'Thomas Graf'
On 01/13/15 at 03:06pm, David Laight wrote: OK, ht-mutes saves the day. Might be worth a comment to save people looking at the code in isolation from worrying and doing a bit search. OTOH it might be obvious from a slightly larger fragment than the diff. Good idea. Will do this. Also, thanks

Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-12 Thread David Miller
From: Thomas Graf Date: Mon, 12 Jan 2015 23:58:21 + > Each per bucket lock covers a configurable number of buckets. While > shrinking, two buckets in the old table contain entries for a single > bucket in the new table. We need to lock down both while linking. > Check if they are protected

[PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-12 Thread Thomas Graf
Each per bucket lock covers a configurable number of buckets. While shrinking, two buckets in the old table contain entries for a single bucket in the new table. We need to lock down both while linking. Check if they are protected by different locks to avoid a recursive lock. Fixes: 97defe1e

[PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-12 Thread Thomas Graf
Each per bucket lock covers a configurable number of buckets. While shrinking, two buckets in the old table contain entries for a single bucket in the new table. We need to lock down both while linking. Check if they are protected by different locks to avoid a recursive lock. Fixes: 97defe1e

Re: [PATCH net-next] rhashtable: Lower/upper bucket may map to same lock while shrinking

2015-01-12 Thread David Miller
From: Thomas Graf tg...@suug.ch Date: Mon, 12 Jan 2015 23:58:21 + Each per bucket lock covers a configurable number of buckets. While shrinking, two buckets in the old table contain entries for a single bucket in the new table. We need to lock down both while linking. Check if they are