[PATCH 2/2] arm64: Use simpler arithmetics for the linear map macros

Linus Torvalds torvalds at linux-foundation.org
Mon Feb 1 18:17:04 EST 2021


On Mon, Feb 1, 2021 at 3:05 PM Ard Biesheuvel <ardb at kernel.org> wrote:
>
> Why still subtract PAGE_OFFSET on both sides of the comparison here?

Because otherwise you'd have to use 'addr' twice in a macro, and write
it something like

   #define __is_lm_address(addr) \
        (((u64)(addr) >= PAGE_OFFSET) &&  < ((u64)(addr) < PAGE_END))

which then would require you to do a local variable in a statement
expression to avoid the double evaluation..

              Linus



More information about the linux-arm-kernel mailing list