Memory pages not released by the filesystem after a truncate

Houssem Daoud houssem.daoud at
Tue Jul 5 19:24:12 EDT 2016


My system experiencing problems with atomic memory allocations. Device 
drivers are not able to allocate contiguous memory regions due to a high 
fragmentation level.

At the time of failure: /proc/meminfo shows the following information:
MemTotal: 4021820 Kb
MemFree: 121912 Kb
Active: 1304396 Kb
Inactive: 2377124 Kb

Most of the memory is consumed by the LRU inactive list and only 121 Mb 
is available to the system.
By using a tracer, I found that most of the pages in the inactive list 
are created by the ext4 journal during a truncate operation.
The call stack of the allocation is:

The problem is easily reproducible using the following script:
while true;
dd if=/dev/zero of=output.dat  bs=100M count=1

Is that a normal behavior ? I know that the philosophy of memory 
management in Linux is to use the available memory as much as possible, 
but what is the need of keeping truncated pages in the LRU if we know 
that they are not even accessible ?

The problem of the inactive list growth occurs only with the journal 
mode of ext4, not with the write-back mode.

A chart representing the utilization of memory during the test is 
provided in this link:


More information about the Kernelnewbies mailing list