Re: [PATCH] x86: mm: accurate the comments for STEP_SIZE_SHIFT macro

From: H. Peter Anvin
Date: Mon Mar 18 2013 - 18:53:14 EST


On 03/18/2013 02:19 PM, Yinghai Lu wrote:
> On Mon, Mar 18, 2013 at 12:14 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>
>> Instead, try to explain why 5 is the correct value in the current code
>> and how it is (or should be!) derived.
>
> initial mapped size is PMD_SIZE, aka 2M.
> if we use step_size to be PUD_SIZE aka 1G, as most worse case
> that 1G is cross the 1G boundary, and PG_LEVEL_2M is not set,
> we will need 1+1+512 pages (aka 2M + 8k) to map 1G range with PTE.
> So i picked (30-21)/2 to get 5.
>
> Please check attached patch.
>
> Thanks
>
> Yinghai
>

This still seems very opaque. I need to look at it and see if it makes
more sense in context.

-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/