[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190219235349.GA17351@ziepe.ca>
Date: Tue, 19 Feb 2019 16:53:49 -0700
From: Jason Gunthorpe <jgg@...pe.ca>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org
Subject: xarray reserve/release?
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
Powered by blists - more mailing lists