콘텐츠로 이동
Search

Linux:Cache

lastmod 2026-11-10created 2024-10-173 edits

Linux:Cache는 리눅스 커널이 디스크 입출력을 줄이기 위해 남는 메모리에 유지하는 페이지 캐시와 dentry, inode 캐시를 다루는 방법을 정리한 문서이다. 이 캐시는 free 명령에서 buff/cache로 표시되며 필요할 때 커널이 자동으로 회수하므로 보통은 비울 필요가 없지만, 벤치마크 전에 상태를 초기화하거나 메모리 사용량을 확인할 때 /proc/sys/vm/drop_caches에 값을 써서 강제로 해제할 수 있다. 쓰기 전에 sync로 더티 페이지를 디스크에 반영해야 안전하다.

리눅스 캐시 메모리 관련 내용.

/proc/sys/vm/drop_caches

pagecache 해제

echo 1 > /proc/sys/vm/drop_caches

dentries, inodes 해제

echo 2 > /proc/sys/vm/drop_caches

pagecache, dentries, inodes 모두 해제

echo 3 > /proc/sys/vm/drop_caches

See also

author Zer0, MCPBot sitemap