Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jan Kara
On Thu 18-07-13 14:37:15, Andrew Morton wrote: > On Thu, 18 Jul 2013 15:09:32 +0200 Jan Kara wrote: > > > On Wed 17-07-13 16:12:00, Andrew Morton wrote: > > > On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > > > > > > BUG_ON(in_interrupt()) :) > > Or maybe WARN_ON()... But it's not so

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jan Kara
On Thu 18-07-13 15:30:27, Jens Axboe wrote: > On 07/18/2013 07:09 AM, Jan Kara wrote: > > On Wed 17-07-13 16:12:00, Andrew Morton wrote: > >> On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > >> > >>> With users of radix_tree_preload() run from interrupt (CFQ is one such > >>> possible user),

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jens Axboe
On Mon, Jul 22 2013, Jan Kara wrote: > On Thu 18-07-13 15:30:27, Jens Axboe wrote: > > On 07/18/2013 07:09 AM, Jan Kara wrote: > > > On Wed 17-07-13 16:12:00, Andrew Morton wrote: > > >> On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > > >> > > >>> With users of radix_tree_preload() run from

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jens Axboe
On Mon, Jul 22 2013, Jan Kara wrote: On Thu 18-07-13 15:30:27, Jens Axboe wrote: On 07/18/2013 07:09 AM, Jan Kara wrote: On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jan Kara
On Thu 18-07-13 15:30:27, Jens Axboe wrote: On 07/18/2013 07:09 AM, Jan Kara wrote: On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-22 Thread Jan Kara
On Thu 18-07-13 14:37:15, Andrew Morton wrote: On Thu, 18 Jul 2013 15:09:32 +0200 Jan Kara j...@suse.cz wrote: On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: BUG_ON(in_interrupt()) :) Or maybe WARN_ON()... But it's

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Andrew Morton
On Thu, 18 Jul 2013 15:09:32 +0200 Jan Kara wrote: > On Wed 17-07-13 16:12:00, Andrew Morton wrote: > > On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > > > > BUG_ON(in_interrupt()) :) > Or maybe WARN_ON()... But it's not so easy :) Currently radix tree code > assumes that if gfp_mask

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jens Axboe
On 07/18/2013 07:09 AM, Jan Kara wrote: > On Wed 17-07-13 16:12:00, Andrew Morton wrote: >> On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: >> >>> With users of radix_tree_preload() run from interrupt (CFQ is one such >>> possible user), the following race can happen: >>> >>>

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jens Axboe
On 07/17/2013 05:12 PM, Andrew Morton wrote: > On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > >> With users of radix_tree_preload() run from interrupt (CFQ is one such >> possible user), the following race can happen: >> >> radix_tree_preload() >> ... >> radix_tree_insert() >>

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jan Kara
On Wed 17-07-13 16:12:00, Andrew Morton wrote: > On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > > > With users of radix_tree_preload() run from interrupt (CFQ is one such > > possible user), the following race can happen: > > > > radix_tree_preload() > > ... > > radix_tree_insert() > >

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jan Kara
On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert()

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jens Axboe
On 07/17/2013 05:12 PM, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert()

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Jens Axboe
On 07/18/2013 07:09 AM, Jan Kara wrote: On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload()

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-18 Thread Andrew Morton
On Thu, 18 Jul 2013 15:09:32 +0200 Jan Kara j...@suse.cz wrote: On Wed 17-07-13 16:12:00, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: BUG_ON(in_interrupt()) :) Or maybe WARN_ON()... But it's not so easy :) Currently radix tree code assumes that

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread Andrew Morton
On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: > With users of radix_tree_preload() run from interrupt (CFQ is one such > possible user), the following race can happen: > > radix_tree_preload() > ... > radix_tree_insert() > radix_tree_node_alloc() > if (rtp->nr) { > ret =

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread David Daney
On 07/17/2013 04:12 PM, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert() radix_tree_node_alloc()

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread Jens Axboe
On Tue, Jul 16 2013, Jan Kara wrote: > With users of radix_tree_preload() run from interrupt (CFQ is one such > possible user), the following race can happen: > > radix_tree_preload() > ... > radix_tree_insert() > radix_tree_node_alloc() > if (rtp->nr) { > ret = rtp->nodes[rtp->nr -

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread Jens Axboe
On Tue, Jul 16 2013, Jan Kara wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert() radix_tree_node_alloc() if (rtp-nr) { ret = rtp-nodes[rtp-nr - 1];

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread David Daney
On 07/17/2013 04:12 PM, Andrew Morton wrote: On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert()

Re: [PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-17 Thread Andrew Morton
On Tue, 16 Jul 2013 19:06:30 +0200 Jan Kara j...@suse.cz wrote: With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert() radix_tree_node_alloc() if (rtp-nr) { ret =

[PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-16 Thread Jan Kara
With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert() radix_tree_node_alloc() if (rtp->nr) { ret = rtp->nodes[rtp->nr - 1]; ... radix_tree_preload() ... radix_tree_insert()

[PATCH RFC] lib: Make radix_tree_node_alloc() irq safe

2013-07-16 Thread Jan Kara
With users of radix_tree_preload() run from interrupt (CFQ is one such possible user), the following race can happen: radix_tree_preload() ... radix_tree_insert() radix_tree_node_alloc() if (rtp-nr) { ret = rtp-nodes[rtp-nr - 1]; interrupt ... radix_tree_preload() ...