[PATCH] arm64/mm: Drop ARM64_KERNEL_USES_PMD_MAPS

Anshuman Khandual anshuman.khandual at arm.com
Mon Nov 7 18:32:32 PST 2022



On 11/7/22 20:52, Will Deacon wrote:
> On Mon, Sep 26, 2022 at 08:48:22AM +0530, Anshuman Khandual wrote:
>> On 9/23/22 19:08, Joey Gouly wrote:
>>> On Fri, Sep 23, 2022 at 06:38:41PM +0530, Anshuman Khandual wrote:
>>>> Currently ARM64_KERNEL_USES_PMD_MAPS is an unnecessary abstraction. Kernel
>>>> mapping at PMD (aka huge page aka block) level, is only applicable with 4K
>>>> base page, which makes it 2MB aligned, a necessary requirement for linear
>>>> mapping and physical memory start address. This can be easily achieved by
>>>> directly checking against base page size itself. This drops off the macro
>>>> ARM64_KERNE_USES_PMD_MAPS which is redundant.
>>>>
>>>> Cc: Catalin Marinas <catalin.marinas at arm.com>
>>>> Cc: Will Deacon <will at kernel.org>
>>>> Cc: linux-arm-kernel at lists.infradead.org
>>>> Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>
>>>> ---
>>>> This applies on v6.0-rc6 after the following patch.
>>>>
>>>> https://lore.kernel.org/all/20220920014951.196191-1-wangkefeng.wang@huawei.com/
>>>>
>>>>  arch/arm64/include/asm/kernel-pgtable.h | 33 +++++++++----------------
>>>>  arch/arm64/mm/mmu.c                     |  2 +-
>>>>  2 files changed, 12 insertions(+), 23 deletions(-)
> 
> [...]
> 
>>>> @@ -96,15 +101,6 @@
>>>>  #define INIT_IDMAP_DIR_PAGES	EARLY_PAGES(KIMAGE_VADDR, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE, 1)
>>>>  
>>>>  /* Initial memory map size */
>>>> -#if ARM64_KERNEL_USES_PMD_MAPS
>>>> -#define SWAPPER_BLOCK_SHIFT	PMD_SHIFT
>>>> -#define SWAPPER_BLOCK_SIZE	PMD_SIZE
>>>> -#define SWAPPER_TABLE_SHIFT	PUD_SHIFT
>>>> -#else
>>>> -#define SWAPPER_BLOCK_SHIFT	PAGE_SHIFT
>>>> -#define SWAPPER_BLOCK_SIZE	PAGE_SIZE
>>>> -#define SWAPPER_TABLE_SHIFT	PMD_SHIFT
>>>> -#endif
>>>
>>> Also a dangling comment here.
>>
>> These ? can be dropped off without much problem.
>>
>> /* Initial memory map size */
>> /*
>>  * Initial memory map attributes.
>>  */
>>
>> Will try to re-arrange these comments next time around.
> 
> Did you post another version of this, or change your mind about it?

Will post another version soon.



More information about the linux-arm-kernel mailing list