diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-04-18 18:04:57 +0200 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-04-22 10:08:37 +0100 |
commit | 1dff8083a024650c75a9c961c38082473ceae8cf (patch) | |
tree | 7e160165fa5e964a90359e7e8c7e353f34f5bc57 /arch/avr32/mm/clear_page.S | |
parent | 86d618cd1d9fdf4b46b68eb014d4fbde08c4ae62 (diff) |
mm: replace open coded page to virt conversion with page_to_virt()
The open coded conversion from struct page address to virtual address in
lowmem_page_address() involves an intermediate conversion step to pfn
number/physical address. Since the placement of the struct page array
relative to the linear mapping may be completely independent from the
placement of physical RAM (as is that case for arm64 after commit
dfd55ad85e 'arm64: vmemmap: use virtual projection of linear region'),
the conversion to physical address and back again should factor out of
the equation, but unfortunately, the shifting and pointer arithmetic
involved prevent this from happening, and the resulting calculation
essentially subtracts the address of the start of physical memory and
adds it back again, in a way that prevents the compiler from optimizing
it away.
Since the start of physical memory is not a build time constant on arm64,
the resulting conversion involves an unnecessary memory access, which
we would like to get rid of. So replace the open coded conversion with
a call to page_to_virt(), and use the open coded conversion as its
default definition, to be overriden by the architecture, if desired.
The existing arch specific definitions of page_to_virt are all equivalent
to this default definition, so by itself this patch is a no-op.
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/avr32/mm/clear_page.S')
0 files changed, 0 insertions, 0 deletions