After using the CONFING_SQUASHFS_DECOMP_SINGLE=y option in an experimental kernel the memory usage dropped significantly. The traces below are for -45 and the experimental -46 kernel. The 1 and 4 are the number of CPUs on the system.
A single CPU system used to consumer 131MB per mounted snap, this is now reduced to just 4MB/snap. A four-CPU system has less dramatic improvement where the numbers are 7MB -> 4MB. This suggests some kind of bug in the CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU option perhaps + echo Ubuntu 16.04 Ubuntu 16.04 + ./analyze.py ubuntu 16.04 4.4.0-45-generic 1 size-1m.squashfs.xz.heavy # num-mounted extra-memory delta 0: 142.60MB 1: 274.71MB (delta: 132.11MB) 2: 406.55MB (delta: 131.84MB) 3: 538.36MB (delta: 131.81MB) 4: 670.19MB (delta: 131.82MB) + ./analyze.py ubuntu 16.04 4.4.0-46-generic 1 size-1m.squashfs.xz.heavy # num-mounted extra-memory delta 0: 62.28MB 1: 66.99MB (delta: 4.71MB) 2: 71.05MB (delta: 4.07MB) 3: 75.12MB (delta: 4.06MB) 4: 79.19MB (delta: 4.07MB) + ./analyze.py ubuntu 16.04 4.4.0-45-generic 4 size-1m.squashfs.xz.heavy # num-mounted extra-memory delta 0: 235.43MB 1: 242.38MB (delta: 6.96MB) 2: 249.38MB (delta: 7.00MB) 3: 256.45MB (delta: 7.06MB) 4: 263.42MB (delta: 6.97MB) + ./analyze.py ubuntu 16.04 4.4.0-46-generic 4 size-1m.squashfs.xz.heavy # num-mounted extra-memory delta 0: 72.79MB 1: 75.90MB (delta: 3.11MB) 2: 79.96MB (delta: 4.06MB) 3: 83.93MB (delta: 3.97MB) 4: 88.00MB (delta: 4.07MB) -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1636847 Title: unexpectedly large memory usage of mounted snaps Status in Snappy: New Status in linux package in Ubuntu: Confirmed Bug description: This is a tracking bug for what might be kernel bugs or kernel configuration changes. As described [1], memory used by simply mounting a squashfs file (even an empty one) is ranging from almost nothing (on certain distributions) to 131MB on Ubuntu 16.04 and 16.10 on a single-core machine or VM. The amount is excessive and should be investigated by the kernel team. We may need to change the kernel or at least the configuration we ship in our packages and kernel snaps. [1] https://github.com/zyga/mounted-fs-memory-checker To manage notifications about this bug go to: https://bugs.launchpad.net/snappy/+bug/1636847/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp