MADV_REMOVE
MADV_REMOVE is a Linux memory-advice operation that punches a hole in the backing object of an eligible shared mapping without changing the object's logical size.
Backing-object change: Linux v6.14 converts the advised virtual range to a file offset and calls hole punching with KEEP_SIZE. This changes the backing object, not merely the caller's cached view. Reads within the affected part of the object's logical extent return zeros until another write changes it. [1] [3]
Mapping capability: the pinned kernel tests VM_SHARED and VM_MAYWRITE, not current VM_WRITE alone. A presently read-only mapping can retain potential write capability. This is a versioned implementation detail, not permission to ignore file access checks or filesystem support. [2] [1]
Storage limits: whole filesystem blocks may be deallocated while partial blocks are zeroed. Requested bytes therefore need not equal released allocation. Logical removal does not prove secure erasure or power-loss persistence; synchronization remains a separate requirement. [3] [4]
Comparison: MADV_DONTNEED can discard a private view without punching a hole in its file; MADV_FREE instead addresses disposable private anonymous memory. The companion analysis separates these contracts from its earlier measured discard experiment. [5]
Failure scope: an unmapped gap can produce ENOMEM even when mapped parts were processed. An error is not an unchanged-data guarantee. The v6.14 walker retains earlier effects if a later mapping fails. [1]