Re: [PATCH RFC v3 01/19] mm: thread user_addr through page allocator for cache-friendly zeroing

Matthew Wilcox
2026-04-24T18:41:19Z

On Tue, Apr 21, 2026 at 06:01:10PM -0400, Michael S. Tsirkin wrote:
> Thread a user virtual address from vma_alloc_folio() down through
> the page allocator to post_alloc_hook(). This is plumbing preparation
> for a subsequent patch that will use user_addr to call folio_zero_user()
> for cache-friendly zeroing of user pages.
>
> The user_addr is stored in struct alloc_context and flows through:
> vma_alloc_folio -> folio_alloc_mpol -> __alloc_pages_mpol ->
> __alloc_frozen_pages -> get_page_from_freelist -> prep_new_page ->
> post_alloc_hook

I don't like this. I think we should instead lift the zeroing from
post_alloc_hook() to the callers of __alloc_frozen_pages().

I don't understand why you want to remove the double-zeroing of memory
when the user has asked for zero_on_alloc. They asked for stupid things,
let them bear the cost.