7

Without programs open, my computer uses about 512M of memory. Yesterday, I had nothing open, yet 2 GB of mem use (used - cache = 2153):

             total       used       free     shared    buffers     cached
Mem:          3261       2875        386         30        199        523
-/+ buffers/cache:       2153       1108
Swap:         8187          0       8187

Top showed no processes taking this up:

top - 23:10:38 up 1 day, 14:35,  3 users,  load average: 0,31, 0,94, 1,29
Tasks: 172 total,   3 running, 169 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6,5 us,  4,2 sy,  0,0 ni, 89,1 id,  0,1 wa,  0,0 hi,  0,1 si,  0,0 st
KiB Mem:   3340164 total,  2937728 used,   402436 free,   201484 buffers
KiB Swap:  8384444 total,      180 used,  8384264 free.   531636 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 2520 halfgaar  20   0 3869744 173620  38568 S   1,6  5,2  52:20.03 plasma-desktop
 1535 root      20   0  246420 108512  40420 S   2,0  3,2  22:36.65 Xorg
 2665 halfgaar  20   0 1354660  50624  15116 R   0,0  1,5   0:10.08 krunner
 2513 halfgaar  20   0 2966468  48564  19280 S   0,0  1,5   0:34.62 kwin
 2306 halfgaar  20   0 1329360  41448  12488 S   0,0  1,2   0:09.80 kded4
 2675 halfgaar  20   0  796712  37360  13804 S   0,0  1,1   0:04.23 kmix
 2619 halfgaar  20   0  649136  34160  14204 S   0,0  1,0   0:00.95 akonadi_mailfil
 2629 halfgaar  20   0  621348  33860  13876 S   0,0  1,0   0:00.88 akonadi_sendlat
 2562 halfgaar  20   0 1242180  33212   2504 S   0,2  1,0   3:20.05 mysqld
 2611 halfgaar  20   0  649132  33048  14140 S   0,0  1,0   0:01.29 akonadi_archive
18552 halfgaar  20   0  508376  32948  24108 S   2,6  1,0   0:02.23 konsole
 2645 halfgaar  20   0  506340  32204   8796 S   0,0  1,0   0:05.13 mintUpdate
 2626 halfgaar  20   0  552648  31768  14152 S   0,0  1,0   0:00.93 akonadi_notes_a
 2430 halfgaar  20   0  556864  30052   9484 S   0,0  0,9   0:10.57 ksmserver
 2546 halfgaar  20   0  866520  28528  12584 S   0,0  0,9   0:04.34 knotify4
 2302 halfgaar  20   0  382404  26896  10112 S   0,0  0,8   0:01.17 kdeinit4
 2304 halfgaar  20   0  387792  23516   4892 S   0,0  0,7   0:00.55 klauncher
 2648 halfgaar  20   0  541576  22824  13864 S   0,0  0,7   0:01.36 polkit-kde-auth
 2623 halfgaar  20   0  390412  19216  13712 S   0,0  0,6   0:00.79 akonadi_newmail
 2615 halfgaar  20   0  340388  18200  13276 S   0,0  0,5   0:00.75 akonadi_maildis
 2621 halfgaar  20   0  303972  17884  13272 S   0,0  0,5   0:00.70 akonadi_migrati
 2612 halfgaar  20   0  306052  17856  13188 S   0,0  0,5   0:00.71 akonadi_followu
 2606 halfgaar  20   0  327700  16772  12600 S   0,0  0,5   0:00.53 akonadi_agent_l
 2613 halfgaar  20   0  321704  16740  12576 S   0,0  0,5   0:00.52 akonadi_agent_l
 2614 halfgaar  20   0  327680  16560  12420 S   0,0  0,5   0:00.54 akonadi_agent_l
 2325 halfgaar  20   0  735344  14928  10116 S   0,0  0,4   0:04.63 kactivitymanage
 2313 halfgaar  20   0  282096  14832   9488 S   0,0  0,4   0:00.74 kglobalaccel
 2554 halfgaar  20   0  276912  14472  10148 S   0,0  0,4   0:02.04 kuiserver

Just to try, I dropped caches:

echo 3 > /proc/sys/vm/drop_caches

And memory usage dropped:

             total       used       free     shared    buffers     cached
Mem:          3261        850       2411         30          1         79
-/+ buffers/cache:        770       2491
Swap:         8187          0       8187

How can this be? Why is cache being stored in a way the kernel thinks it's not cache? Can it be the cache of my ecryptfs encrypted home dir? I did just run a backup of that, so a lot of files and meta data on it were cached.

  • Linux Mint 17.1
  • Kernel 3.13.0-37
  • did you run a slabtop when it was happening to see if anything that looked encryptfs-related had a lot of memory associated with it? – Bratchley Apr 28 '15 at 20:00
  • Some background: How much RAM does the kernel use? – Gilles Apr 28 '15 at 22:12
  • I'll have to reproduce it first, and then I'll look at slabtop. Will be continued. – Halfgaar Apr 29 '15 at 12:15
3

Writing a 1 to drop_caches only drops the ( data ) cache. The 3 also drops the dentry cache, or cache of names of files on the disk. If you had recently been working with directories containing many small files, that would account for it.

  • Would it? It would not be reported as memory usage. It would be subtracted in the +/- swap column, right? – Halfgaar Apr 29 '15 at 12:15
  • @Halfgaar, no, the +/- cache line only counts the main data cache. The dentry cache is part of the kernel slab. It is normally much smaller than the main data cache, but can be quite significant if you are working with many ( as in hundreds of thousands or millions ) of small files. – psusi Apr 30 '15 at 1:41
  • Your answer and me remembering something is the answer. I was experimenting with vfs_cache_pressure. I had set it to one, to create a huge slab for inodes and dentries, but I had forgotten that :) – Halfgaar Apr 30 '15 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.