On Fri, 29 Aug 2025 at 10:18, Arnaldo Carvalho de Melo <arnaldo.m...@gmail.com> wrote: > > As long as we don't lose those mmap events due to memory pressure/lost > events and we have timestamps to order it all before lookups, yeah > should work.
The main reason to lose mmap events that I can see is that you start tracing in the middle of running something (for example, tracing systemd or some other "started at boot" thing). Then you'd not have any record of an actual mmap at all because it happened before you started tracing, even if there is no memory pressure or other thing going on. That is not necessarily a show-stopper: you could have some fairly simple count for "how many times have I seen this hash", and add a "mmap reminder" event (which would just be the exact same thing as the regular mmap event). You do it for the first time you see it, and every N times afterwards (maybe by simply using a counter array that is indexed by the low bits of the hash, and incrementing it for every hash you see, and if it was zero modulo N you do that "mmap reminder" thing). Yes, at that point you'd need to do that whole "generate path and build ID", but if 'N' is a large enough number, it's pretty rare. Maybe using a 16-bit counter would be sufficient (ie N would naturally be 65536 when it becomes zero again). That might be a good thing regardless just to have some guaranteed limit of how far back in the trace you need to go to find the mmap information for some hash. If you have long traces, maybe you don't want to walk back billions of events. But I wouldn't suggest doing that as a *first* implementation. I'm just saying that it could be added if people find that it's a problem. Linus