Re: [PATCH] mm/vmalloc: Fix unlock order in s_stop()
From: Matthew Wilcox
Date: Mon Dec 14 2020 - 10:39:34 EST
On Mon, Dec 14, 2020 at 04:11:28PM +0100, Uladzislau Rezki wrote:
> On Sun, Dec 13, 2020 at 09:51:34PM +0000, Matthew Wilcox wrote:
> > If we need to iterate the list efficiently, i'd suggest getting rid of
> > the list and using an xarray instead. maybe a maple tree, once that code
> > is better exercised.
>
> Not really efficiently. We need just a full scan of it propagating the
> information about mapped and un-purged areas to user space applications.
>
> For example RCU-safe list is what we need, IMHO. From the other hand i
> am not sure if xarray is RCU safe in a context of concurrent removing/adding
> an element(xa_remove()/xa_insert()) and scanning like xa_for_each_XXX().
It's as RCU safe as an RCU-safe list. Specifically, it guarantees:
- If an element is present at all times between the start and the
end of the iteration, it will appear in the iteration.
- No element will appear more than once.
- No element will appear in the iteration that was never present.
- The iteration will terminate.
If an element is added or removed between the start and end of the
iteration, it may or may not appear. Causality is not guaranteed (eg
if modification A is made before modification B, modification B may
be reflected in the iteration while modification A is not).