If the size configured for tmpfs is bigger than the size of RAM, and there is a lot of stuff stored there in the tmpfs, how is the amount of RAM available to applications determined? If applications need more memory then, does system only have swap memory to offer, or can tmpfs free RAM for applications? I think it is more important to run applications in RAM than have a file system in RAM. Does setting of swappiness affect applications only or tmpfs, too?

  • 1
    tmpfs is also backed by swap. It could get swapped out too.
    – muru
    Feb 4 '16 at 10:45
  • it uses as much RAM as is needed to hold all of the data you store in it. findmnt -nttmpfs -oTARGET,USED
    – mikeserv
    Feb 4 '16 at 10:53
  • @mikeserv, USED is undefined here. What, if the data is larger than RAM?
    – jarno
    Feb 4 '16 at 17:43
  • @jarno - i dunno what the USED is undefined thing is supposed to mean, but if you have stored more data in a tmpfs than you have RAM then either you are swapping heavily... or I don't think there is an or.
    – mikeserv
    Feb 4 '16 at 17:45
  • @mikeserv The command you gave outputs "findmnt: unknown column: USED".
    – jarno
    Feb 4 '16 at 19:32

The content of a tmpfs filesystem is split between RAM and swap, just like the memory of processes is split between RAM and swap. All data has to be in RAM when it's used. If there isn't enough room, the kernel moves data to swap. The basic idea is that the data that hasn't been used in the longest time gets moved to swap first, regardless of whether it's process memory or tmpfs content.

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.