public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* xarray reserve/release?
@ 2019-02-19 23:53 Jason Gunthorpe
  2019-02-20  1:26 ` Matthew Wilcox
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2019-02-19 23:53 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-kernel

Hey Matt,

Did you intend that xa_release doesn't work on allocating arrays:

	xa_init_flags(&xa, XA_FLAGS_ALLOC);
	xa_reserve(&xa, 0, GFP_KERNEL);
	WARN_ON(xa_empty(&xa));
	xa_release(&xa, 0);
	WARN_ON(!xa_empty(&xa));

Triggers the second WARN_ON. 

If FLAGS_ALLOC is removed this passes

This creates kind of a confusing / super unexpected situation where 

   xa_for_each (xa, id)
       xa_erase(xa, id);
   WARN_ON(!xa_empty(&xa))

Is not safe with XA_FLAGS_ALLOC??

Seems like at least deserves a documentation note.. Or maybe ALLOC
xa_empty should do something different?

Thanks,
Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-20 21:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19 23:53 xarray reserve/release? Jason Gunthorpe
2019-02-20  1:26 ` Matthew Wilcox
2019-02-20  3:46   ` Jason Gunthorpe
2019-02-20 17:14     ` Matthew Wilcox
2019-02-20 17:43       ` Jason Gunthorpe
2019-02-20 20:47         ` Matthew Wilcox
2019-02-20 21:18           ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox