public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Brian Geffon <bgeffon@google.com>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] PM: hibernate: Drain trailing zero pages on userspace restore
Date: Mon, 9 Mar 2026 12:26:26 +0100	[thread overview]
Message-ID: <aa6uYoVKegcac2Kq@igalia.com> (raw)
In-Reply-To: <20260309001250.192841-1-berto@igalia.com>

On Mon, Mar 09, 2026 at 01:12:50AM +0100, Alberto Garcia wrote:
>  	case SNAPSHOT_ATOMIC_RESTORE:
> +		/*
> +		 * We need to call snapshot_write_next() one last time
> +		 * before finalizing in order to process any trailing
> +		 * zero pages.
> +		 */
> +		error = snapshot_write_next(&data->handle);
> +		if (error < 0)
> +			break;

I realized that this patch assumes that userspace calls
SNAPSHOT_ATOMIC_RESTORE only after having written the full image,
but if that happens earlier I'm not sure that it's safe to call
snapshot_write_next().

An alternative solution would be to do it at the beginning of
snapshot_write_finalize() if handle->cur > nr_meta_pages + 1.

If you think that's a better idea I can send v2 of the patch.

Regards,

Berto

  reply	other threads:[~2026-03-09 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  0:12 [PATCH] PM: hibernate: Drain trailing zero pages on userspace restore Alberto Garcia
2026-03-09 11:26 ` Alberto Garcia [this message]
2026-03-09 15:01   ` Brian Geffon
2026-03-09 15:57     ` Alberto Garcia
2026-03-09 16:08       ` Brian Geffon

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=aa6uYoVKegcac2Kq@igalia.com \
    --to=berto@igalia.com \
    --cc=bgeffon@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /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