Re: [PATCH v2 1/4] mm: avoid unnecessary lru drain for wp_can_reuse_anon_folio()
From: Barry Song
Date: Mon Jun 29 2026 - 19:17:44 EST
On Mon, Jun 29, 2026 at 3:52 PM David Hildenbrand (Arm)
<david@xxxxxxxxxx> wrote:
[...]
>
> So yeah, if Nadav's reproducer works even without the drain (which I assume), we
> could indeed think about just removing this optimization here.
Yet I think the problem is resolved with the exclusive flag.
Right now, we can still have cases where "exclusive" cannot
address it, such as:
#include <sys/mman.h>
int main(int argc, char *argv[])
{
int i;
#define SIZE 30*1024*1024
while(1) {
volatile int *p = mmap(0, SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
volatile int q;
for (int i = 0; i < SIZE/sizeof(int); i++)
p[i] = i;
madvise((void *)p, SIZE, MADV_PAGEOUT);
if (!fork())
_exit(0);
for (int i = 0; i < SIZE/sizeof(int); i++)
q = p[i];
for (int i = 0; i < SIZE/sizeof(int); i++)
p[i] = i;
munmap(p, SIZE);
}
return 0;
}
I assume this is less frequent and less of a concern?
Thanks
Barry