On Thu, Feb 17, 2022 at 12:13:53AM +0000, Matthew Wilcox wrote: > On Wed, Feb 16, 2022 at 03:57:39PM -0800, Shakeel Butt wrote: > > On Wed, Feb 16, 2022 at 3:12 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > > > > [...] > > > > Here I'd keep _page (or _folio, if you want), because > > > > it makes it clear that the function goes over all pages > > > > (and is expensive therefore). > > > > > > But there's no intrinsic reason that it should. If that's a > > > performance problem, you could keep slabs on a separate list > > > from, eg, file or anon memory. > > > > > > > Is there enough space in the struct slab for that list or do you mean > > something different? > > Well, I don't know what data structure your for_each_page() uses, so > I don't know what to suggest exactly. > > If it's an iteration over the entirety of memmap, then maybe you'd > rather iterate over each kmem_cache like /proc/slabinfo does? For SLUB /proc/slabinfo ignores pages on percpu partial lists, which can significantly alter results. For slabinfo.py the accuracy is more important than performance, at least in my understanding. It's not a tool which a generic linux user would run often.