diff mbox series

[v3] hibernate: pageoffline may be first judged

Message ID cab2e5d5baeb1f5cbe5a2f20930e50164f893cc8.camel@kylinos.cn
State New
Headers show
Series [v3] hibernate: pageoffline may be first judged | expand

Commit Message

lijun April 3, 2025, 2:10 a.m. UTC
From: Li Jun <lijun01@kylinos.cn>
Date: Mon, 10 Feb 2025 10:40:58 +0800
Subject: [PATCH] hibernate: pageoffline may be first judged

'PageReserved' and 'PageOffline' have weights greater
than 'is_forbidden' and 'is_free'.so,PageReserved
and PageOffline should be first judged.
just as the page is free,but is reserved.

the ordering of checks in 'for_each_populated_zone(zone)'
It means that hundreds of thousands or even millions of
pages need to be judged, reducing the judgment of one
statement may save some time.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
---
 kernel/power/snapshot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

    if (page_is_guard(page))
@@ -1387,9 +1387,6 @@ static struct page *saveable_page(struct zone
*zone, unsigned long pfn)

    BUG_ON(PageHighMem(page));

-   if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page))
-       return NULL;
-
    if (PageOffline(page))
        return NULL;

@@ -1397,6 +1394,9 @@ static struct page *saveable_page(struct zone
*zone, unsigned long pfn)
        && (!kernel_page_present(page) || pfn_is_nosave(pfn)))
        return NULL;

+   if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page))
+       return NULL;
+
    if (page_is_guard(page))
        return NULL;
diff mbox series

Patch

diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index c9fb559a6399..dfbccddb28f1 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1328,10 +1328,10 @@  static struct page
*saveable_highmem_page(struct zone *zone, unsigned long pfn)

    BUG_ON(!PageHighMem(page));

-   if (swsusp_page_is_forbidden(page) ||  swsusp_page_is_free(page))
+   if (PageReserved(page) || PageOffline(page))
        return NULL;

-   if (PageReserved(page) || PageOffline(page))
+   if (swsusp_page_is_forbidden(page) ||  swsusp_page_is_free(page))
        return NULL;