Re: [PATCH v2 1/5] ARC: mm: remove __ARCH_USE_5LEVEL_HACK

From: Vineet Gupta
Date: Tue Oct 15 2019 - 18:06:49 EST


On 10/15/19 2:48 PM, Linus Torvalds wrote:
> On Tue, Oct 15, 2019 at 12:19 PM Vineet Gupta
> <Vineet.Gupta1@xxxxxxxxxxxx> wrote:
>> This is a non-functional change anyways since ARC has software page walker
>> with 2 lookup levels (pgd -> pte)
>
> Could we encourage other architectures to do the same, and get rid of
> all uses of __ARCH_USE_5LEVEL_HACK?

IMHO this should have been done at the onset. The actual changes don't seem that
difficult, just need to add the missing p4d calls although I can sympathize with
hassles of coordinating/building/testing/yadi yada cross arch.

OTOH, the [45]LEVEL_HACK seem like a nice way to "fold" the levels: the
skipped/folded level vanishes completely. Among others it does things like

#define p4d_t pgd_t

On ARC 2-level code:

free_pte_range
pmd_pgtable(*pmd);

((((((*pmd).pud).pgd))) & PAGE_MASK)); <-- 5LEVEL_HACK
vs.
((((((((*pmd).pud).p4d).pgd)))) & PAGE_MASK )); <-- w/o 5LEVEL_HACK

pmd_clear(pmd);

*(pmd)).pud).pgd)))) = 0
vs.
*(pmd)).pud).p4d).pgd)))) = 0


So we may not be able to fix all he historical misgivigs, but this might alleviate
the pain a bit. I'll try to dabble a bit.

Thx for taking a look and te ACKs.
-Vineet