[PATCH 0/4 v3][bionic:linux] nr_writeback memory leak in kernel 4.15.0-137+

Tim Gardner tim.gardner at canonical.com
Thu Apr 29 18:54:53 UTC 2021


v2: Added some more fix patches at the suggestion of Thadeu Lima de Souza
Cascardo <cascardo at canonical.com>
v3: Proper subject line

BugLink: https://bugs.launchpad.net/bugs/1926081

[Impact]

Ubuntu 18.04.5 4.15.0 LTS kernels at version 4.15.0-137 and above contain a
memory leak due to the inclusion of patch from the upstream kernel, but not
the fix for that patch which was released later.

Bad patch in bionic:linux 2c17fa778db85644458b52a7df8eacc402cbc1ef mm:
memcontrol: fix excessive complexity in memory.stat reporting

[Test Plan]

See bug report for extended discussion. Test results are positive.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1926081/comments/24

The following is enough to permanently increase the value of `nr_writeback`.

cat > breakme.sh <<EOF
date
grep nr_writeback /proc/vmstat
mkdir -p /docker/testfiles/{1..5}

seq -w 1 100000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=/docker/testfiles/1/file.% bs=4k count=10 status=none' &
seq -w 1 100000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=/docker/testfiles/2/file.% bs=4k count=10 status=none' &
seq -w 1 100000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=/docker/testfiles/3/file.% bs=4k count=10 status=none' &
seq -w 1 100000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=/docker/testfiles/4/file.% bs=4k count=10 status=none' &
seq -w 1 100000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=/docker/testfiles/5/file.% bs=4k count=10 status=none' &

wait $(jobs -p)
grep nr_writeback /proc/vmstat
date
EOF

[Where problems could occur]

Memory leakage could continue. The new spinlocks could cause some performance degradation.

[Other Info]

All of these patches have been accepted to v4.14.y




More information about the kernel-team mailing list