Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
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>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	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:54:57 -0500	[thread overview]
Message-ID: <20261130155348-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJZ5v0jRD-KAFeH_RSneS9+hbm8K5h9koN7v8wbUG7-34f4f2Q@mail.gmail.com>

On Mon, Nov 30, 2026 at 07:48:25PM +0100, Rafael J. Wysocki (Intel) wrote:
> On Mon, Nov 30, 2026 at 6:03 PM 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.
> 
> Why would that matter?
> 
> The image kernel will still regard those pages as free, won't it?

Well there's presumably a point to reporting right?  Specifically, I'm
using it to free up host memory.  Currently, the host will not free this
memory, and it could.


> > Clear the flag on save.
> >
> > Fixes: 36e66c554b5c ("mm: introduce Reported pages")
> > Cc: Andrea Arcangeli <aarcange@redhat.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Dave Hansen <dave.hansen@intel.com>
> > Cc: David Hildenbrand <david@redhat.com>
> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Cc: Luiz Capitulino <lcapitulino@redhat.com>
> > Cc: Matthew Wilcox <willy@infradead.org>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Michal Hocko <mhocko@kernel.org>
> > Cc: Nitesh Narayan Lal <nitesh@redhat.com>
> > Cc: Oscar Salvador <osalvador@suse.de>
> > Cc: Pankaj Gupta <pagupta@redhat.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Rik van Riel <riel@surriel.com>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Cc: Wei Wang <wei.w.wang@intel.com>
> > Cc: Yang Zhang <yang.zhang.wz@gmail.com>
> > Cc: wei qi <weiqi4@huawei.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  kernel/power/snapshot.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> > index d5dba0e50b2eb..82775e91f79c5 100644
> > --- 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);
> > +
> >                         pfn = page_to_pfn(page);
> >                         for (i = 0; i < (1UL << order); i++) {
> >                                 if (!--page_count) {
> > --
> > MST
> >


      reply	other threads:[~2026-11-30 20:55 UTC|newest]

Thread overview: 3+ 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 [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=20261130155348-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --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=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