tmpfs will use swap space if necessary (this can happen even if tmpfs is half the size of RAM, because other things also use RAM), and “half RAM” is just the default size (quite normal defaul) of the file system. You can install it in whatever you want when installing or reinstalling using the "size" argument:
Mount options for tmpfs
size=nbytes Override default maximum size of the filesystem. The size is given in bytes, and rounded up to entire pages. The default is half of the memory. The size parameter also accepts a suffix % to limit this tmpfs instance to that percentage of your physical RAM: the default, when neither size nor nr_blocks is specified, is size=50%
If your distribution uses fstab to mount tmpfs, you can add, for example. 'size = 40G'. You can also remount it at any time using:
mount -o remount,size=40G /dev/shm
Be careful. If the files on tmpfs take up too much of your virtual memory (RAM + swap), applications can be killed (byt OOM killer), and the whole system may crash.
Back to your questions ...
I don’t think it’s easy to determine what will be replaced, since AFAIK at this level for Linux everything (including process data memory, files in cached disks, mmaped disk, tmpfs files) is the same “virtual memory” Linux may consider some pages more important (recently used), others are ready to be replaced, so it can be part of the tmpfs file, and part of another process replaced.
Jacek konieczny
source share