Re: [PATCH v3 1/4] x86/clear_page: extend clear_page*() for multi-page clearing

From: Matthew Wilcox
Date: Mon Apr 14 2025 - 16:09:29 EST


On Mon, Apr 14, 2025 at 12:52:37PM -0700, Ankur Arora wrote:
> Ingo Molnar <mingo@xxxxxxxxxx> writes:
> >> +void clear_pages_orig(void *page, unsigned int length);
> >> +void clear_pages_rep(void *page, unsigned int length);
> >> +void clear_pages_erms(void *page, unsigned int length);
> >
> > What unit is 'length' in? If it's bytes, why is this interface
> > artificially limiting itself to ~4GB? On x86-64 there's very little (if
>
> I was in two minds about the unit. Given that the largest page size is
> 1GB, decided to go with 32bit. But, as you say below, there's no reason
> to limit the x86-64 interface for MM reasons. Will fix.

Actually, I think there is (and we went through this with SPARC, if you
remember?) We _shouldn't_ be calling memset() with a large size (ie
larger than 4GB). If we have that much memory to clear, we should be
doing something smarter, like using padata to get lots of CPUs clearing
individual portions of the page.

I don't know how relevant this is now that you're going to be using
ALTERNATIVES.