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

Michael S. Tsirkin
2026-04-26T20:54:46Z

On Fri, Apr 24, 2026 at 07:41:03PM +0100, Matthew Wilcox wrote:
> 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().

can you and david agree somehow? I don't like being caught betweem
maintainers like this.

> 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.

it's just a side effect. I did not even test what effect it has.
what I care about is the overhead with
reporting.