1.. SPDX-License-Identifier: GPL-2.0 2 3.. include:: ../disclaimer-zh_CN.rst 4 5:Original: Documentation/filesystems/tmpfs.rst 6 7translated by Wang Qing<wangqing@vivo.com> 8 9===== 10Tmpfs 11===== 12 13Tmpfs��������������������������������������������������������������������� 14 15tmpfs������������������������������������������������������������������������������������������ 16������������tmpfs������������������������������������������������������ 17 18tmpfs������������������������������������������������������������������������������������������������ 19������swap������������������������������������������������mount -o remount ...������������ 20 21���ramfs���������tmpfs���������������������tmpfs���������������������������������tmpfs������������ 22���������������RAM���������/dev/ram*���������������������RAM��������������������������������������� 23���������������������������������������������Ramdisks������swap��������������������������������������� 24 25������tmpfs������������������������������swap������������������tmpfs������������/proc/meminfo 26���������������Shmem������������free(1)���������������Shared��������������������������������������� 27������������(shmem������������ipcs(1))������������������������������������������df(1)���du(1)��� 28 29tmpfs��������������������� 30 311) ���������������������������������������������������������������������������SYSV��������������� 32 33 ������������������CONFIG_TMPFS���������CONFIG_TMPFS������������tmpfs��������������������� 34 ��������������������������������� 35 362) glibc 2.2������������������������tmpfs���������/dev/shm������������POSIX������������ 37 (shm_open���shm_unlink)������������������/etc/fstab������������������ 38 39 tmpfs /dev/shm tmpfs defaults 0 0 40 41 ���������������������������������tmpfs������������ 42 43 SYSV���������������������������������������������������(���2.3������������������������������ 44 tmpfs���������(shm fs)������������SYSV������������) 45 463) ������������������������������������/tmp���/var/tmp������������������������������������������ 47 swap���������������������������tmpfs��������������������������������������������������������� 48 ������mkinitrd������/tmp������/tmp��� 49 504) ���������������������������������������:-) 51 52 53tmpfs��������������������������������������������� 54 55========= =========================================================== 56size tmpfs������������������������������������������������swap���������RAM������������ 57 ������tmpfs���������������������������������������OOM��������������������������������� 58nr_blocks ���size���������������PAGE_SIZE������������ 59nr_inodes tmpfs���������������inode��������������������������������������������������������� 60 (������������������������)������������RAM��������������������������������������� 61========= =========================================================== 62 63������������������������k���m���g������������������������������������������remount������������ 64size������������������������������������tmpfs������������������RAM��������������� 65���������size���nr_blocks������������������size=50��� 66 67������nr_blocks=0������size=0������block������������������������������nr_inodes=0��� 68inode��������������������������������������������������������������������������������������������������� 69������������������tmpfs������������������������������������������������������������������������CPU��� 70��������������������� 71 72tmpfs���������������������������NUMA������������������������������(���������������CONFIG_NUMA), 73���������������mount -o remount ...��������� 74 75======================== ========================= 76mpol=default ������������������������ 77 (��������� set_mempolicy(2)) 78mpol=prefer:Node ������������������������������ 79mpol=bind:NodeList ��������������������������������� 80mpol=interleave ������������������������������������ 81mpol=interleave:NodeList ��������������������������� 82mpol=local ������������������������������ 83======================== ========================= 84 85NodeList���������������������������������������������������������������������������������������������- 86���������������������������������������������mpol=bind0-3,5,7,9-15 87 88������������NodeList������������������������������������������������������������������������������������ 89���������������������������������������������������������������������NodeList������������������������������ 90������������������cpuset[���������Documentation/admin-guide/cgroup-v1/cpusets.rst] 91������������������������������������������������NodeLists������������������������������������������������ 92������������������������������ 93 94NUMA������������������������������������������������������������������������tmpfs��������������������� 95���������������NodeList��������������� 96Documentation/admin-guide/mm/numa_memory_policy.rst��������������������������� 97������������������������������������������������ 98 99:: 100 101 =static ��������� MPOL_F_STATIC_NODES 102 =relative ��������� MPOL_F_RELATIVE_NODES 103 104���������mpol=bind=staticNodeList���������MPOL_BIND|MPOL_F_STATIC_NODES��������������� 105 106���������������������������������NUMA���������������mpol������������tmpfs���������������nodelist��������� 107���������������������������������������������������������������������������������������NUMA������(��������������� 108revocery������)���������������������������������������������������������������������mpol��������������������� 109������������������������mount -o remount,mpol=Policy:NodeList MountPoint������������������������ 110 111������������������������������������������������������������ 112 113==== ==================== 114������ ������������������������������ 115uid ������ID 116gid ���ID 117==== ==================== 118 119���������������remount������������������������������������chmod(1),chown(1)���chgrp(1)��������� 120������������������������ 121 122tmpfs������������32���������64���inode������������������ 123 124======= ============= 125inode64 ������64���inode 126inode32 ������32���inode 127======= ============= 128 129���32������������������������inode32������������������inode64��������������� 130���64������������������������������CONFIG_TMPFS_INODE64���inode64��������������������������������������� 131������������inode������������������������32���������������������glibc������������������tmpfs���������������33 132���inode���������������EOVERFLOW������������������������������������2GiB���������������������EINVAL��� 133 134������'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs'������ 135/mytmpfs���������tmpfs������������������������root���������������10GB RAM/SWAP������������10240��� 136inode������������ 137 138 139:������: 140 Christoph Rohland <cr@sap.com>, 1.12.01 141:������: 142 Hugh Dickins, 4 June 2007 143:������: 144 KOSAKI Motohiro, 16 Mar 2010 145:������: 146 Chris Down, 13 July 2020 147