On 2/23/22 04:45, Hyeonggon Yoo wrote: > On Wed, Feb 23, 2022 at 01:32:36AM +0100, Vlastimil Babka wrote: >> Hm it would be easier just to disable merging when the precise counters are >> enabled. Assume it would be a config option (possibly boot-time option with >> static keys) anyway so those who don't need them can avoid the overhead. > > Is it possible to accurately account objects in SLUB? I think it's not > easy because a CPU can free objects to remote cpu's partial slabs using > cmpxchg_double()... AFAIU Roman's idea would be that each alloc/free would simply inc/dec an object counter that's disconnected from physical handling of particular sl*b implementation. It would provide exact count of objects from the perspective of slab users. I assume for reduced overhead the counters would be implemented in a percpu fashion as e.g. vmstats. Slabinfo gathering would thus have to e.g. sum up those percpu counters. > Or would you count them by iterating all of cpu partial slabs and node > partial slabs? (Something like drgn script or new procfs file?) >