[PATCH] mm/zswap: use workqueue to destroy pool

2016-04-26 Thread Dan Streetman
Add a work_struct to struct zswap_pool, and change __zswap_pool_empty to use the workqueue instead of using call_rcu(). When zswap destroys a pool no longer in use, it uses call_rcu() to perform the destruction/freeing. Since that executes in softirq context, it must not sleep. However, actually

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-27 Thread Dan Streetman
On Tue, Apr 26, 2016 at 8:58 PM, Sergey Senozhatsky wrote: > Hello, > > On (04/26/16 17:08), Dan Streetman wrote: > [..] >> -static void __zswap_pool_release(struct rcu_head *head) >> +static void __zswap_pool_release(struct work_struct *work) >> { >> - struct zswap_pool *pool = container_of(

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-27 Thread Sergey Senozhatsky
Hello Dan, On (04/27/16 13:19), Dan Streetman wrote: [..] > > so in general the patch look good to me. > > > > it's either I didn't have enough coffee yet (which is true) or > > _IN THEORY_ it creates a tiny race condition; which is hard (and > > unlikely) to hit, but still. and the problem being

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-27 Thread Sergey Senozhatsky
On (04/28/16 10:40), Sergey Senozhatsky wrote: [..] > the bigger issue here (and I was thinking at some point of fixing it, > but then I grepped to see how many API users are in there, and I gave > up) is that it seems we have no way to check if the dir exists in debugfs. well, unless we want to d

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-28 Thread Dan Streetman
On Wed, Apr 27, 2016 at 9:40 PM, Sergey Senozhatsky wrote: > Hello Dan, > > On (04/27/16 13:19), Dan Streetman wrote: > [..] >> > so in general the patch look good to me. >> > >> > it's either I didn't have enough coffee yet (which is true) or >> > _IN THEORY_ it creates a tiny race condition; whi

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-28 Thread Sergey Senozhatsky
On (04/26/16 17:08), Dan Streetman wrote: > Add a work_struct to struct zswap_pool, and change __zswap_pool_empty > to use the workqueue instead of using call_rcu(). > > When zswap destroys a pool no longer in use, it uses call_rcu() to > perform the destruction/freeing. Since that executes in so

Re: [PATCH] mm/zswap: use workqueue to destroy pool

2016-04-26 Thread Sergey Senozhatsky
Hello, On (04/26/16 17:08), Dan Streetman wrote: [..] > -static void __zswap_pool_release(struct rcu_head *head) > +static void __zswap_pool_release(struct work_struct *work) > { > - struct zswap_pool *pool = container_of(head, typeof(*pool), rcu_head); > + struct zswap_pool *pool = conta