Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-13 Thread Herbert Xu
On Thu, Dec 13, 2018 at 02:48:59PM +1100, NeilBrown wrote: > > Yes, you could rcu_free the old one and allocate a new one. Then you > would have to be ready to deal with memory allocation failure which > complicates usage (I already don't like that rhashtable_insert() can > report -ENOMEM!).

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread NeilBrown
On Thu, Dec 13 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 07:49:08PM +1100, NeilBrown wrote: >> On Wed, Dec 12 2018, Herbert Xu wrote: >> >> > On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: >> >> >> >> So you would substantially slow down the rhashtable_walk_start() step. >> >

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread Herbert Xu
On Wed, Dec 12, 2018 at 07:49:08PM +1100, NeilBrown wrote: > On Wed, Dec 12 2018, Herbert Xu wrote: > > > On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: > >> > >> So you would substantially slow down the rhashtable_walk_start() step. > > > > This whole thing is meant for uses such as

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread NeilBrown
On Wed, Dec 12 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: >> >> So you would substantially slow down the rhashtable_walk_start() step. > > This whole thing is meant for uses such as /proc and netlink > enumeration. Speed is definitely not a prerogative

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread Herbert Xu
On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: > > So you would substantially slow down the rhashtable_walk_start() step. This whole thing is meant for uses such as /proc and netlink enumeration. Speed is definitely not a prerogative of these iterators. For that matter, if speed was

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-11 Thread NeilBrown
On Wed, Dec 12 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 11:02:35AM +1100, NeilBrown wrote: >> >> So I think this is a real bug - it is quite unlikely to hit, but >> possibly. >> You need a chain with at least 2 objects, you need >> rhashtable_walk_stop() to be called after visiting an

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-11 Thread Herbert Xu
On Wed, Dec 12, 2018 at 11:02:35AM +1100, NeilBrown wrote: > > So I think this is a real bug - it is quite unlikely to hit, but > possibly. > You need a chain with at least 2 objects, you need > rhashtable_walk_stop() to be called after visiting an object other than > the last object, and you

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-11 Thread NeilBrown
On Tue, Dec 11 2018, Herbert Xu wrote: > Hi Neil: > > On Mon, Dec 10, 2018 at 09:50:43AM +1100, NeilBrown wrote: >> I think it was agreed that I would not pursue features that were only >> of use to out-of-tree code, but I don't think that applies here. This >> is not a feature, this is a

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-10 Thread Herbert Xu
Hi Neil: On Mon, Dec 10, 2018 at 09:50:43AM +1100, NeilBrown wrote: > I think it was agreed that I would not pursue features that were only > of use to out-of-tree code, but I don't think that applies here. This > is not a feature, this is a quality-of-implementation improvement. > There are

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-09 Thread NeilBrown
On Fri, Dec 07 2018, Herbert Xu wrote: > On Wed, Dec 05, 2018 at 02:51:02PM +1100, NeilBrown wrote: >> >> If the sequence: >>obj = rhashtable_walk_next(iter); >>rhashtable_walk_stop(iter); >>rhashtable_remove_fast(ht, >head, params); >>rhashtable_walk_start(iter); >> >> races

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-06 Thread Herbert Xu
On Wed, Dec 05, 2018 at 02:51:02PM +1100, NeilBrown wrote: > > If the sequence: >obj = rhashtable_walk_next(iter); >rhashtable_walk_stop(iter); >rhashtable_remove_fast(ht, >head, params); >rhashtable_walk_start(iter); > > races with another thread inserting or removing > an