3 ms·
Because it's legal for a platform to perform page deduplication as long as from the perspective of the program the correct operating model is followed, many ope
by codys 7y ago
Because it's legal for a platform to perform page deduplication as long as from the perspective of the program the correct operating model is followed, many operating systems (including Linux) have a "zero page" that is used for _all_ zeroed memory blocks in the system. Writing a non zero value then would replace it with a different page.
This means that writing zero is unlikely to cause a real allocation to occur. Writing a non zero value may be more likely to cause a page allocation.
That said: it can be entirely legal for a platform to do more page deduplication than just special casing the zero page. Linux has some kernel tooling called KSM (kernel same page merging).