Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

2015-12-08 Thread Herbert Xu
On Wed, Dec 09, 2015 at 10:43:23AM +0800, Herbert Xu wrote: > > OK after thinking about it a little bit more I think your approach > is safe and we won't need to play any more games to get this to > work. So I'm fine with this patch. One suggestion though: your inline function doesn't actually in

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

2015-12-08 Thread Herbert Xu
On Tue, Dec 08, 2015 at 09:14:24AM -0800, Tom Herbert wrote: > > That creates one more level of indirection. I don't see how add an > atomic replace operation adds any complexity to the rhashtable, none > of the semantics for rhashtable need to be changed. OK after thinking about it a little bit

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

2015-12-08 Thread Tom Herbert
On Tue, Dec 8, 2015 at 1:39 AM, Herbert Xu wrote: > David Miller wrote: >> From: Tom Herbert >> Date: Tue, 1 Dec 2015 15:11:09 -0800 >> >>> + lock = rht_bucket_lock(tbl, hash); >>> + >>> + spin_lock_bh(lock); >>> + >>> + pprev = &tbl->buckets[hash]; >>> + rht_for_each(he, tbl, ha

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

2015-12-08 Thread Herbert Xu
David Miller wrote: > From: Tom Herbert > Date: Tue, 1 Dec 2015 15:11:09 -0800 > >> + lock = rht_bucket_lock(tbl, hash); >> + >> + spin_lock_bh(lock); >> + >> + pprev = &tbl->buckets[hash]; >> + rht_for_each(he, tbl, hash) { >> + if (he != obj_old) { >> +

Re: [PATCH net-next v2 2/5] rhashtable: add function to replace an element

2015-12-03 Thread David Miller
From: Tom Herbert Date: Tue, 1 Dec 2015 15:11:09 -0800 > + lock = rht_bucket_lock(tbl, hash); > + > + spin_lock_bh(lock); > + > + pprev = &tbl->buckets[hash]; > + rht_for_each(he, tbl, hash) { > + if (he != obj_old) { > + pprev = &he->next; > +