Re: xarray reserve/release?

2019-02-20 Thread Jason Gunthorpe
On Wed, Feb 20, 2019 at 12:47:26PM -0800, Matthew Wilcox wrote: > On Wed, Feb 20, 2019 at 10:43:33AM -0700, Jason Gunthorpe wrote: > > On Wed, Feb 20, 2019 at 09:14:14AM -0800, Matthew Wilcox wrote: > > > > void __xa_release(struct xarray *xa, unsigned long index) > > > > { > > > >

Re: xarray reserve/release?

2019-02-20 Thread Matthew Wilcox
On Wed, Feb 20, 2019 at 10:43:33AM -0700, Jason Gunthorpe wrote: > On Wed, Feb 20, 2019 at 09:14:14AM -0800, Matthew Wilcox wrote: > > > void __xa_release(struct xarray *xa, unsigned long index) > > > { > > > XA_STATE(xas, xa, index); > > > void *curr; > > > > > > curr = xas_load(); > > >

Re: xarray reserve/release?

2019-02-20 Thread Jason Gunthorpe
On Wed, Feb 20, 2019 at 09:14:14AM -0800, Matthew Wilcox wrote: > > void __xa_release(struct xarray *xa, unsigned long index) > > { > > XA_STATE(xas, xa, index); > > void *curr; > > > > curr = xas_load(); > > if (curr == XA_ZERO_ENTRY) > > xas_store(, NULL); > > } > >

Re: xarray reserve/release?

2019-02-20 Thread Matthew Wilcox
On Tue, Feb 19, 2019 at 08:46:27PM -0700, Jason Gunthorpe wrote: > On Tue, Feb 19, 2019 at 05:26:09PM -0800, Matthew Wilcox wrote: > > On Tue, Feb 19, 2019 at 04:53:49PM -0700, Jason Gunthorpe wrote: > > > Hey Matt, > > > > > > Did you intend that xa_release doesn't work on allocating arrays: > >

Re: xarray reserve/release?

2019-02-19 Thread Jason Gunthorpe
On Tue, Feb 19, 2019 at 05:26:09PM -0800, Matthew Wilcox wrote: > On Tue, Feb 19, 2019 at 04:53:49PM -0700, Jason Gunthorpe wrote: > > Hey Matt, > > > > Did you intend that xa_release doesn't work on allocating arrays: > > That surprises me. I'll take a look in the morning. I think the issue

Re: xarray reserve/release?

2019-02-19 Thread Matthew Wilcox
On Tue, Feb 19, 2019 at 04:53:49PM -0700, Jason Gunthorpe wrote: > Hey Matt, > > Did you intend that xa_release doesn't work on allocating arrays: That surprises me. I'll take a look in the morning. (giving me the test case is perfect, btw)

xarray reserve/release?

2019-02-19 Thread Jason Gunthorpe
Hey Matt, Did you intend that xa_release doesn't work on allocating arrays: xa_init_flags(, XA_FLAGS_ALLOC); xa_reserve(, 0, GFP_KERNEL); WARN_ON(xa_empty()); xa_release(, 0); WARN_ON(!xa_empty()); Triggers the second WARN_ON. If FLAGS_ALLOC is removed