← Back to context

Comment by toast0

2 days ago

Returning no longer used anonymous memory is not without benefits.

Returning pages allows them to be used for disk cache. They can be zeroed in the background by the kernel which may save time when they're needed again, or zeroing can be avoided if the kernel uses them as the destination of a full page DMA write.

Also, returning no longer used pages helps get closer to a useful memory used measurement. Measuring memory usage is pretty difficult of course, but making the numbers a little more accurate helps.

Zeroed pages also compress more efficiently because the compressor doesn’t actually need to process them.