Re: [RFC PATCH 4/4] x86/mm: write protect (most) page tables

From: Mike Rapoport
Date: Tue Aug 24 2021 - 09:33:08 EST


On Mon, Aug 23, 2021 at 04:50:10PM -0700, Dave Hansen wrote:
> On 8/23/21 6:25 AM, Mike Rapoport wrote:
>
> I'm also cringing a bit at hacking this into the page allocator. A
> *lot* of what you're trying to do with getting large allocations out and
> splitting them up is done very well today by the slab allocators. It
> might take some rearrangement of 'struct page' metadata to be more slab
> friendly, but it does seem like a close enough fit to warrant investigating.

I did this at the page allocator level in a hope that (1) it would be
possible to use such cache for allocations if different orders and (2)
having a global cache of unmapped pages will utilize memory more
efficiently and will reduce direct map fragmentation.
And slab allocators may be the users of the cache at page allocator level.

For the single use case of page tables, slabs may work, but in more general
case I don't see them as a good fit.

I'll take a closer look to using slab anyway, maybe it'll work out.

--
Sincerely yours,
Mike.