CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2025/11/21 02:49:33
Modified files:
sys/tmpfs : tmpfs_mem.c tmpfs_vfsops.c
Log message:
Modify the behavior of tmpfs limitations. Keep the global memory limit
of all tmpfs instances, however each instance mounted with '-s' option
decreases available limit by given value. This value can't be greater
than available space. The instance mounted with with '-s' option
consumes it's own limit and does no impact to other tmpfs instances. The
instances mounted without '-s' option share all available limit and do
not affect on instances mounted with '-s'. Now it is impossible to mount
instance with '-s' option if passed value is greater than available
limit.
Tested with dbp(1) by kirill, ok mpi
For example, this machine has 2G of RAM, so tmpfs is limited with 1G.
Please note, the +- 1Mb depends of how 'dd', 'df' and 'mount_tmpfs'
expose the sizes.
# mount_tmpfs tmpfs /mnt/t0
# mount_tmpfs tmpfs /mnt/t1
# mount_tmpfs -s 720M tmpfs /mnt/t2
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 0B 257M 0% /mnt/t0
tmpfs 257M 0B 257M 0% /mnt/t1
tmpfs 720M 4.0K 720M 1% /mnt/t2
# dd if=/dev/zero of=/mnt/t0/f0 bs=1M count=256
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 256M 560K 100% /mnt/t0
tmpfs 560K 0B 560K 0% /mnt/t1
tmpfs 720M 4.0K 720M 1% /mnt/t2
# mount_tmpfs -s 1M tmpfs /mnt/t3
mount_tmpfs: tmpfs on /mnt/t3: Invalid argument
# mount_tmpfs -s 1K tmpfs /mnt/t3
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 256M 556K 100% /mnt/t0
tmpfs 556K 0B 556K 0% /mnt/t1
tmpfs 720M 4.0K 720M 1% /mnt/t2
tmpfs 4.0K 4.0K 0B 100% /mnt/t3
# mount_tmpfs tmpfs /mnt/t3
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 256M 560K 100% /mnt/t0
tmpfs 560K 0B 560K 0% /mnt/t1
tmpfs 720M 4.0K 720M 1% /mnt/t2
tmpfs 560K 0B 560K 0% /mnt/t3
# dd if=/dev/zero of=/mnt/t2/f0 bs=1M count=128
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 256M 560K 100% /mnt/t0
tmpfs 560K 0B 560K 0% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
# rm -rf /mnt/t0/f0
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 257M 0B 257M 0% /mnt/t0
tmpfs 257M 0B 257M 0% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
# mount_tmpfs -s 128M tmpfs /mnt/t3
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 129M 0B 129M 0% /mnt/t0
tmpfs 129M 0B 129M 0% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
tmpfs 128M 4.0K 128M 1% /mnt/t3
# dd if=/dev/zero of=/mnt/t0/f0 bs=1M count=32
# dd if=/dev/zero of=/mnt/t1/f0 bs=1M count=64
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 193M 32.0M 161M 17% /mnt/t0
tmpfs 225M 64.0M 161M 29% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
# mount_tmpfs -s 128M tmpfs /mnt/t3
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 64.5M 32.0M 32.5M 50% /mnt/t0
tmpfs 96.5M 64.0M 32.5M 67% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
tmpfs 128M 4.0K 128M 1% /mnt/t3
# dd if=/dev/zero of=/mnt/t1/f1 bs=1M count=64
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 129M 32.0M 96.5M 25% /mnt/t0
tmpfs 225M 128M 96.5M 58% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
# mount_tmpfs -s 128M tmpfs /mnt/t3
mount_tmpfs: tmpfs on /mnt/t3: Invalid argument
# mount_tmpfs -s 96M tmpfs /mnt/t3
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 32.5M 32.0M 560K 99% /mnt/t0
tmpfs 129M 128M 560K 100% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
tmpfs 96.0M 4.0K 96.0M 1% /mnt/t3
# mount_tmpfs tmpfs /mnt/t4
# mount_tmpfs tmpfs /mnt/t5
# mount_tmpfs tmpfs /mnt/t6
# mount_tmpfs tmpfs /mnt/t7
# mount_tmpfs tmpfs /mnt/t8
# df -t tmpfs -h
Filesystem Size Used Avail Capacity Mounted on
tmpfs 32.5M 32.0M 560K 99% /mnt/t0
tmpfs 129M 128M 560K 100% /mnt/t1
tmpfs 720M 128M 592M 18% /mnt/t2
tmpfs 96.0M 4.0K 96.0M 1% /mnt/t3
tmpfs 560K 0B 560K 0% /mnt/t4
tmpfs 560K 0B 560K 0% /mnt/t5
tmpfs 560K 0B 560K 0% /mnt/t6
tmpfs 560K 0B 560K 0% /mnt/t7
tmpfs 560K 0B 560K 0% /mnt/t8