[PATCH] arm64: mm: Create gigabyte kernel logical mappings where possible

Steve Capper steve.capper at linaro.org
Fri May 2 02:21:57 PDT 2014


On Fri, May 02, 2014 at 09:51:21AM +0100, Catalin Marinas wrote:
> On Wed, Apr 30, 2014 at 12:36:22PM +0100, Steve Capper wrote:
> > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> > index 4d29332..867e979 100644
> > --- a/arch/arm64/mm/mmu.c
> > +++ b/arch/arm64/mm/mmu.c
> > @@ -234,7 +234,20 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
> >  	pud = pud_offset(pgd, addr);
> >  	do {
> >  		next = pud_addr_end(addr, end);
> > -		alloc_init_pmd(pud, addr, next, phys);
> > +
> > +		/*
> > +		 * For 4K granule only, attempt to put down a 1GB block
> > +		 */
> > +		if ((PAGE_SHIFT == 12) &&
> > +			((addr | next | phys) & ~PUD_MASK) == 0) {
> > +			pud_t old_pud = *pud;
> > +			set_pud(pud, __pud(phys | prot_sect_kernel));
> > +
> > +			if (!pud_none(old_pud))
> > +				flush_tlb_all();
> 
> We could even free the original pmd here. I think a
> memblock_free(pud_pfn(old_pud) << PAGE_SHIFT, PAGE_SIZE) should do
> (untested, and you need to define pud_pfn).

I see what you mean, we will potentially have an unused page in our
swapper_pg_dir array.

I'll have a think, and add some logic to remove the redundant page.

Cheers,
-- 
Steve

> 
> -- 
> Catalin



More information about the linux-arm-kernel mailing list