On Thu, Mar 31, 2022 at 11:26 AM NeilBrown <neilb@xxxxxxx> wrote: > > On Mon, 28 Feb 2022, Muchun Song wrote: > > If we run 10k containers in the system, the size of the > > list_lru_memcg->lrus can be ~96KB per list_lru. When we decrease the > > number containers, the size of the array will not be shrinked. It is > > not scalable. The xarray is a good choice for this case. We can save > > a lot of memory when there are tens of thousands continers in the > > system. If we use xarray, we also can remove the logic code of > > resizing array, which can simplify the code. > > > > Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> > > Hi, > I've just tried some simple testing on NFS (xfstests generic/???) and > it reliably crashes in this code. > Specifically in list_lru_add(), list_lru_from_kmem() returns NULL, > which results in a NULL deref. > list_lru_from_kmem() returns NULL because an xa_load() returns NULL. Did you test with the patch [1]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ae085d7f9365de7da27ab5c0d16b12d51ea7fca9 > > The patch doesn't make any sense to me. It replaces an array of > structures with an xarray, which is an array of pointers. > It seems to assume that all the pointers in the array get magically > allocated to the required structures. I certainly cannot find when > the 'struct list_lru_node' structures get allocated. So xa_load() will > *always* return NULL in this code. struct list_lru_node is allocated via kmem_cache_alloc_lru(). > > I can provide more details of the failure stack if needed, but I doubt > that would be necessary. > If the above fix cannot fix your issue, would you mind providing the .config and stack trace? Thanks for your report.