在 2024/12/6 21:58, Matthew Wilcox 写道:
On Thu, Dec 05, 2024 at 10:30:38PM +0800, Jinjiang Tu wrote:During our tests in containers, there is a read-only file (i.e., sharedShow your test.
I mmap an overlayfs file with PROT_READ, and call madvise(MADV_COLLAPSE), the code is as follows: fd = open(path, O_RDONLY); addr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); ret = madvise(addr, size, MADV_COLLAPSE); The addr isn't THP-aligned and ret is -1, errno is EINVAL.