Re:0+0 > 0: C++ thread-local storage performance
by dzaima on Tuesday February 18, 2025 @01:13PM
(#43093120)
Interesting! Some searching later, looks like htop's DATA/M_DRS counter (i.e. second-to-last number in /proc/<PID>/statm) appears to count something related-ish; i.e. doesn't count a PROT_NONE mmap, but does a PROT_READ|PROT_WRITE untouched one; nothing in statm appears to count untouched writable MAP_SHARED though, though (potentially?-)shared mappings do get complicated in general.
[ Parent
| on HN ]
Re:0+0 > 0: C++ thread-local storage performance
by fweimer on Tuesday February 18, 2025 @02:24PM
(#43093913)
Is MADV_FREE memory charged? It contributes to classic RSS, but can be discarded by the kernel if it deems that beneficial.
Re:0+0 > 0: C++ thread-local storage performance
by dzaima on Tuesday February 18, 2025 @02:38PM
(#43094049)
Some more experimentation later, it seems to be more like just counting PROT_WRITE+MAP_PRIVATE mappings or so; i.e. mprotect(PROT_NONE)ing (or even just PROT_READ) a writable region results in it not being counted, even if the region was modified and thus must actually be persisted. So it can actually get meaningfully lower than RSS. :/
MADV_FREE doesn't affect anything afaict.