Re: [PATCH vfs 1/2] lib: implement ptrset

2014-12-02 Thread Tejun Heo
Hello, Jan. On Tue, Nov 25, 2014 at 05:37:07PM +0100, Jan Kara wrote: > On Thu 13-11-14 17:09:27, Tejun Heo wrote: > > Implement set of pointers. Pointers can be added, deleted and > > iterated. It's currently implemented as a thin rbtree wrapper making > > addition and removal O(log N). A

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-12-02 Thread Tejun Heo
Hello, Jan. On Tue, Nov 25, 2014 at 05:37:07PM +0100, Jan Kara wrote: On Thu 13-11-14 17:09:27, Tejun Heo wrote: Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-25 Thread Jan Kara
On Thu 13-11-14 17:09:27, Tejun Heo wrote: > Implement set of pointers. Pointers can be added, deleted and > iterated. It's currently implemented as a thin rbtree wrapper making > addition and removal O(log N). A drawback is that iteration isn't RCU > safe, which is okay for now. This will be

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-25 Thread Jan Kara
On Thu 13-11-14 17:09:27, Tejun Heo wrote: Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback is that iteration isn't RCU safe, which is okay for now. This will be used

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Lai Jiangshan
On 11/18/2014 07:55 PM, Tejun Heo wrote: > Hello, > > On Tue, Nov 18, 2014 at 05:19:18PM +0800, Lai Jiangshan wrote: >> Is it too ugly? > > What is "it"? The whole thing? percpu preloading? I'm just gonna > continue assuming that you're talking about preloading. If you think > it's ugly,

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Andrew Morton
On Fri, 14 Nov 2014 08:12:02 -0500 Tejun Heo wrote: > Hello, Andrew. > > On Thu, Nov 13, 2014 at 02:40:41PM -0800, Andrew Morton wrote: > > In that case tjpointer_add() would need to do a kmalloc() for each inode > > which is added to the bdev/cdev, just as ptrset_add() is doing. > > > > That

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Tejun Heo
Hello, On Tue, Nov 18, 2014 at 06:56:29PM +0300, Azat Khuzhin wrote: > On Thu, Nov 13, 2014 at 05:09:27PM -0500, Tejun Heo wrote: > > +int ptrset_add(void *ptr, struct ptrset *set, gfp_t gfp) > > +{ > > + struct ptrset_elem *elem; > > + struct rb_node *parent, **slot; > > + > > + elem =

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Azat Khuzhin
On Thu, Nov 13, 2014 at 05:09:27PM -0500, Tejun Heo wrote: > +int ptrset_add(void *ptr, struct ptrset *set, gfp_t gfp) > +{ > + struct ptrset_elem *elem; > + struct rb_node *parent, **slot; > + > + elem = kmalloc(sizeof(*elem), gfp); > + if (!elem && !in_interrupt()) /* see

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Tejun Heo
Hello, On Tue, Nov 18, 2014 at 05:19:18PM +0800, Lai Jiangshan wrote: > Is it too ugly? What is "it"? The whole thing? percpu preloading? I'm just gonna continue assuming that you're talking about preloading. If you think it's ugly, please go ahead and explain why you think it is. It's

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Lai Jiangshan
On 11/14/2014 06:09 AM, Tejun Heo wrote: > Implement set of pointers. Pointers can be added, deleted and > iterated. It's currently implemented as a thin rbtree wrapper making > addition and removal O(log N). A drawback is that iteration isn't RCU > safe, which is okay for now. This will be

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Azat Khuzhin
On Thu, Nov 13, 2014 at 05:09:27PM -0500, Tejun Heo wrote: +int ptrset_add(void *ptr, struct ptrset *set, gfp_t gfp) +{ + struct ptrset_elem *elem; + struct rb_node *parent, **slot; + + elem = kmalloc(sizeof(*elem), gfp); + if (!elem !in_interrupt()) /* see

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Tejun Heo
Hello, On Tue, Nov 18, 2014 at 06:56:29PM +0300, Azat Khuzhin wrote: On Thu, Nov 13, 2014 at 05:09:27PM -0500, Tejun Heo wrote: +int ptrset_add(void *ptr, struct ptrset *set, gfp_t gfp) +{ + struct ptrset_elem *elem; + struct rb_node *parent, **slot; + + elem =

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Andrew Morton
On Fri, 14 Nov 2014 08:12:02 -0500 Tejun Heo t...@kernel.org wrote: Hello, Andrew. On Thu, Nov 13, 2014 at 02:40:41PM -0800, Andrew Morton wrote: In that case tjpointer_add() would need to do a kmalloc() for each inode which is added to the bdev/cdev, just as ptrset_add() is doing.

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Lai Jiangshan
On 11/18/2014 07:55 PM, Tejun Heo wrote: Hello, On Tue, Nov 18, 2014 at 05:19:18PM +0800, Lai Jiangshan wrote: Is it too ugly? What is it? The whole thing? percpu preloading? I'm just gonna continue assuming that you're talking about preloading. If you think it's ugly, please go

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Lai Jiangshan
On 11/14/2014 06:09 AM, Tejun Heo wrote: Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback is that iteration isn't RCU safe, which is okay for now. This will be used

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-18 Thread Tejun Heo
Hello, On Tue, Nov 18, 2014 at 05:19:18PM +0800, Lai Jiangshan wrote: Is it too ugly? What is it? The whole thing? percpu preloading? I'm just gonna continue assuming that you're talking about preloading. If you think it's ugly, please go ahead and explain why you think it is. It's almost

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-14 Thread Tejun Heo
Hello, Andrew. On Thu, Nov 13, 2014 at 02:40:41PM -0800, Andrew Morton wrote: > In that case tjpointer_add() would need to do a kmalloc() for each inode > which is added to the bdev/cdev, just as ptrset_add() is doing. > > That might require a nasty preload thing. But really, for just two >

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-14 Thread Tejun Heo
Hello, Andrew. On Thu, Nov 13, 2014 at 02:40:41PM -0800, Andrew Morton wrote: In that case tjpointer_add() would need to do a kmalloc() for each inode which is added to the bdev/cdev, just as ptrset_add() is doing. That might require a nasty preload thing. But really, for just two known

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Andrew Morton
On Thu, 13 Nov 2014 17:27:36 -0500 Tejun Heo wrote: > Hello, Andrew. > > On Thu, Nov 13, 2014 at 02:23:33PM -0800, Andrew Morton wrote: > > This seems rather slow and bloaty. Why not > > > > struct tjpointer { > > struct list_head list; > > void *pointer; > > }; > > > > And then

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Tejun Heo
Hello, Andrew. On Thu, Nov 13, 2014 at 02:23:33PM -0800, Andrew Morton wrote: > This seems rather slow and bloaty. Why not > > struct tjpointer { > struct list_head list; > void *pointer; > }; > > And then callers do things like > > struct tjpointer *tjp; > > lock();

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Andrew Morton
On Thu, 13 Nov 2014 17:09:27 -0500 Tejun Heo wrote: > Implement set of pointers. Pointers can be added, deleted and > iterated. It's currently implemented as a thin rbtree wrapper making > addition and removal O(log N). A drawback is that iteration isn't RCU > safe, which is okay for now.

[PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Tejun Heo
Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback is that iteration isn't RCU safe, which is okay for now. This will be used to remove inode->i_devices. Signed-off-by:

[PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Tejun Heo
Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback is that iteration isn't RCU safe, which is okay for now. This will be used to remove inode-i_devices. Signed-off-by:

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Andrew Morton
On Thu, 13 Nov 2014 17:09:27 -0500 Tejun Heo t...@kernel.org wrote: Implement set of pointers. Pointers can be added, deleted and iterated. It's currently implemented as a thin rbtree wrapper making addition and removal O(log N). A drawback is that iteration isn't RCU safe, which is okay

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Tejun Heo
Hello, Andrew. On Thu, Nov 13, 2014 at 02:23:33PM -0800, Andrew Morton wrote: This seems rather slow and bloaty. Why not struct tjpointer { struct list_head list; void *pointer; }; And then callers do things like struct tjpointer *tjp; lock();

Re: [PATCH vfs 1/2] lib: implement ptrset

2014-11-13 Thread Andrew Morton
On Thu, 13 Nov 2014 17:27:36 -0500 Tejun Heo t...@kernel.org wrote: Hello, Andrew. On Thu, Nov 13, 2014 at 02:23:33PM -0800, Andrew Morton wrote: This seems rather slow and bloaty. Why not struct tjpointer { struct list_head list; void *pointer; }; And then callers