title: How can I keep file-backed executable pages evicted from RAM in Linux?
body: <p>I tried using <code>madvise(MADV_DONTNEED)</code> and verified with <code>/proc/pid/pagemap</code> that pages are unmapped correctly. Although none of the functions in the page is accessed, some of the pages are mapped back pretty soon. From what I read, there are two lists - Active and Inactive. <code>madvise(MADV_DONTNEED)</code> will result in the pages removed from both the lists. If this is correct, is there anything other than a CPU access to an address in the page that can cause the page to be loaded back? References to the code will be really helpful. My goal is to keep the page evicted and not loaded back.</p>