Re: [RFC PATCH 10/47] mm: asi: Support for global non-sensitive direct map allocations

Junaid Shahid
2022-03-23T23:49:51Z

Hi Matthew,

On 3/23/22 14:06, Matthew Wilcox wrote:
> On Tue, Feb 22, 2022 at 09:21:46PM -0800, Junaid Shahid wrote:
>> standard ASI instances. A new page flag is also added so that when
>> these pages are freed, they can also be unmapped from the ASI page
>> tables.
>
> It's cute how you just throw this in as an aside. Page flags are
> in high demand and just adding them is not to be done lightly. Is
> there any other way of accomplishing what you want?
>

I suppose we may be able to use page_ext instead. That certainly should be
feasible for the PG_local_nonsensitive flag introduced in a later patch,
although I am not completely sure about the PG_global_nonsensitive flag. That
could get slightly tricky (though likely still possible to do) in case we need
to allocate any non-sensitive memory before page_ext is initialized. One concern
with using page_ext could be the extra memory usage on large machines.

BTW is page flag scarcity an issue on 64-bit systems as well, or only 32-bit
systems? ASI is only supported on 64-bit systems (at least currently).

>> @@ -542,6 +545,12 @@ TESTCLEARFLAG(Young, young, PF_ANY)
>> PAGEFLAG(Idle, idle, PF_ANY)
>> #endif
>>
>> +#ifdef CONFIG_ADDRESS_SPACE_ISOLATION
>> +__PAGEFLAG(GlobalNonSensitive, global_nonsensitive, PF_ANY);
>
> Why is PF_ANY appropriate?
>

I think we actually can use PF_HEAD here. That would make the alloc_pages path
faster too. I'll change to that. (Initially I had gone with PF_ANY because in
theory, you could allocate a compound page and then break it later and free the
individual pages, but I don't know if that actually happens apart from THP, and
certainly doesn't look like the case for any of the stuff that we have marked as
non-sensitive.)

Thanks,
Junaid