On Tue, Feb 13, 2024 at 4:03 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > > > + apply_to_existing_page_range(&init_mm, bpf_arena_get_kern_vm_start(arena), > > > > + KERN_VM_SZ - GUARD_SZ / 2, for_each_pte, NULL); > > > > > > I'm still reading the rest (so it might become obvious), but this > > > KERN_VM_SZ - GUARD_SZ / 2 is a bit surprising. I understand that > > > kern_vm_start is shifted by GUARD_SZ/2, but is the intent here is to > > > actually go beyond maximum 4GB by GUARD_SZ/2, or the intent was to > > > unmap 4GB (MAX_ARENA_SZ)? > > > > here it's just the range for apply_to_existing_page_range() to walk. > > There are no pages mapped into the lower GUARD_SZ / 2 and upper GUARD_SZ / 2. > > So no reason to ask apply_to_existing_page_range() to walk > > the whole KERN_VM_SZ. > > right, so I expected to see KERN_VM_SZ - GUARD_SZ, but instead we have > KERN_VM_SZ - GUARD_SZ/2 (so we'll iterate GUARD_SZ/2 too much, into > upper guard pages which are supposed to be not allocated), which is > why I'm asking. It's minor, I was probing if I'm missing something > subtle. ahh. you're correct, of course. braino.