]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: memory-failure: use local variable huge to check hugetlb page
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 11 Jul 2023 05:50:12 +0000 (13:50 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Aug 2023 17:12:19 +0000 (10:12 -0700)
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 <linmiaohe@huawei.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory-failure.c

index cac5413c5cc3a99d75e7f67035c37ed18060474b..3b734d51e6dedb9e39c65b80969bc72395ce583c 100644 (file)
@@ -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.