From: Miaohe Lin Date: Tue, 11 Jul 2023 05:50:12 +0000 (+0800) Subject: mm: memory-failure: use local variable huge to check hugetlb page X-Git-Tag: v6.6.7~1970^2~412 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55c7ac4527086d52dedc5da4ee3d676bcc9a7691;p=platform%2Fkernel%2Flinux-starfive.git mm: memory-failure: use local variable huge to check hugetlb page Use local variable huge to check whether page is hugetlb page to avoid calling PageHuge() multiple times to save cpu cycles. PageHuge() will be stable while extra page refcnt is held. Link: https://lkml.kernel.org/r/20230711055016.2286677-5-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi Signed-off-by: Andrew Morton --- diff --git a/mm/memory-failure.c b/mm/memory-failure.c index cac5413..3b734d5 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2617,7 +2617,7 @@ static int soft_offline_in_use_page(struct page *page) } lock_page(page); - if (!PageHuge(page)) + if (!huge) wait_on_page_writeback(page); if (PageHWPoison(page)) { unlock_page(page); @@ -2626,7 +2626,7 @@ static int soft_offline_in_use_page(struct page *page) return 0; } - if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page)) + if (!huge && PageLRU(page) && !PageSwapCache(page)) /* * Try to invalidate first. This should work for * non dirty unmapped page cache pages.