Linux Power Management development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-mm@kvack.org, Andrea Arcangeli <aarcange@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	David Hildenbrand <david@redhat.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Michal Hocko <mhocko@kernel.org>,
	Nitesh Narayan Lal <nitesh@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Pankaj Gupta <pagupta@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Rik van Riel <riel@surriel.com>, Vlastimil Babka <vbabka@suse.cz>,
	Wei Wang <wei.w.wang@intel.com>,
	Yang Zhang <yang.zhang.wz@gmail.com>, wei qi <weiqi4@huawei.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] hibernation: clear PG_reported before saving image
Date: Mon, 30 Nov 2026 15:45:21 -0800	[thread overview]
Message-ID: <20261130154521.2a5f84bdee2669fc8a3fc135@linux-foundation.org> (raw)
In-Reply-To: <ffe1dcb7e4c7975e072295af646c69d08f89090d.1796058103.git.mst@redhat.com>

On Mon, 30 Nov 2026 12:02:56 -0500 "Michael S. Tsirkin" <mst@redhat.com> wrote:

> Free buddy pages are excluded from the hibernation image, but the struct
> page entries containing their PG_reported flags are saved.  If
> PG_reported is set, then after resume, page reporting will never report
> these pages. But this is wrong: the restore kernel may have written to
> these free pages while loading the image.
> 
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -1274,6 +1274,11 @@ static void mark_free_pages(struct zone *zone)
>  		list_for_each_entry(page, free_list, buddy_list) {
>  			unsigned long i;
>  
> +			/*
> +			 * Free page contents are not preserved across hibernation.
> +			 */
> +			__ClearPageReported(page);

peeve: the __FooPageBar() functions are a micro-optimization and
they're scary - if something else can possibly get at this page
concurrently then we have a mess on our hands.

So I like to see a comment against each one which makes it really
really clear that we're not adding a once-per-century race.

Either that, or remove the __ so we can sleep at night.


      parent reply	other threads:[~2026-11-30 23:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 17:02 [PATCH] hibernation: clear PG_reported before saving image Michael S. Tsirkin
2026-11-30 18:48 ` Rafael J. Wysocki (Intel)
2026-11-30 20:54   ` Michael S. Tsirkin
2026-11-30 23:45 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130154521.2a5f84bdee2669fc8a3fc135@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aarcange@redhat.com \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=lcapitulino@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=mst@redhat.com \
    --cc=nitesh@redhat.com \
    --cc=osalvador@suse.de \
    --cc=pagupta@redhat.com \
    --cc=pavel@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rafael@kernel.org \
    --cc=riel@surriel.com \
    --cc=vbabka@suse.cz \
    --cc=wei.w.wang@intel.com \
    --cc=weiqi4@huawei.com \
    --cc=willy@infradead.org \
    --cc=yang.zhang.wz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox