Allocation is not residency
Demand paging prepares a page in response to an access that needs it, rather than necessarily preparing every page when a virtual range is created. A large mapping can therefore exist without every backing page being resident. This postpones work for unused ranges but moves some cost into first access. A page fault can transfer control to the operating system to resolve that access. The existence of a fault alone does not tell you whether storage I/O occurred, whether a new anonymous page was allocated, or whether the access was valid in the first place.
Trace a sparse first touch
Assume 4 KiB pages and a 1 MiB anonymous mapping. There are 256 page-sized positions in the region. A loop that writes one byte on each page can require preparation at each first write under a demand-allocation policy. Repeatedly writing only the first page touches a much smaller footprint despite the same virtual allocation size. This is a simplified calculation of possible work, not a promise of exactly 256 faults on every machine. Huge pages, prefaulting, shared zero pages and implementation choices can change the observed sequence and counters.
Identify the kind of backing
A valid anonymous write may require allocation and initialization of a new page. A file-backed access depends on whether the needed data is already in the page cache or must be fetched from storage. A fault resolved using existing resident data has a different cost profile from one that waits for I/O. An invalid address or disallowed permission is another case entirely: the operating system may report an error rather than supply a new page. Always classify the mapping and permission before describing a fault as useful allocation or as an application failure.
Account for first-access latency
If first-access latency matters, a program can consider touching the required range before the critical phase. That shifts work earlier rather than making it free, and reclaimed pages may need preparation again. Touching the whole mapping can waste memory and initialization time when much of it is never used. Separate allocation, first pass and later passes when measuring. Keep input and placement conditions comparable. Reducing a fault counter is useful only in relation to the latency, footprint and failure behaviour the application actually requires; it is not a sufficient performance goal by itself.