arm64: kexec: reduce calls to page_address()
authorRongwei Wang <rongwei.wang@linux.alibaba.com>
Thu, 25 Nov 2021 17:06:00 +0000 (01:06 +0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 10 Dec 2021 13:57:25 +0000 (13:57 +0000)
In kexec_page_alloc(), page_address() is called twice.
This patch add a new variable to help to reduce calls
to page_address().

Signed-off-by: Rongwei Wang <rongwei.wang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20211125170600.1608-3-rongwei.wang@linux.alibaba.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/machine_kexec.c

index 1038494135c8cef847829ebcf43b6fa58d596770..7f2530bcd42eb5c8c8c3b6e8dad1480afd92b7a6 100644 (file)
@@ -104,13 +104,15 @@ static void *kexec_page_alloc(void *arg)
 {
        struct kimage *kimage = (struct kimage *)arg;
        struct page *page = kimage_alloc_control_pages(kimage, 0);
+       void *vaddr = NULL;
 
        if (!page)
                return NULL;
 
-       memset(page_address(page), 0, PAGE_SIZE);
+       vaddr = page_address(page);
+       memset(vaddr, 0, PAGE_SIZE);
 
-       return page_address(page);
+       return vaddr;
 }
 
 int machine_kexec_post_load(struct kimage *kimage)