public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Dave Chinner <david@fromorbit.com>, Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org,
	 lsf-pc@lists.linux-foundation.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@kernel.org>, Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org
Subject: Re: [Lsf-pc] [LSF/MM/BPF TOPIC] Filesystem Suspend Resume
Date: Mon, 24 Mar 2025 17:02:54 -0400	[thread overview]
Message-ID: <7f3eddf89f8fd128ffeb643bc582e45a7d13c216.camel@HansenPartnership.com> (raw)
In-Reply-To: <Z-HFjTGaOnOjnhLP@dread.disaster.area>

On Tue, 2025-03-25 at 07:50 +1100, Dave Chinner wrote:
> On Mon, Mar 24, 2025 at 12:38:20PM +0100, Jan Kara wrote:
> > On Fri 21-03-25 13:00:24, James Bottomley via Lsf-pc wrote:
> > > On Fri, 2025-03-21 at 08:34 -0400, James Bottomley wrote:
> > > [...]
> > > > Let me digest all that and see if we have more hope this time
> > > > around.
> > > 
> > > OK, I think I've gone over it all.  The biggest problem with
> > > resurrecting the patch was bugs in ext3, which isn't a problem
> > > now.  Most of the suspend system has been rearchitected to
> > > separate suspending user space processes from kernel ones.  The
> > > sync it currently does occurs before even user processes are
> > > frozen.  I think (as most of the original proposals did) that we
> > > just do freeze all supers (using the reverse list) after user
> > > processes are frozen but just before kernel threads are (this
> > > shouldn't perturb the image allocation in hibernate, which was
> > > another source of bugs in xfs).
> > 
> > So as far as my memory serves the fundamental problem with this
> > approach was FUSE - once userspace is frozen, you cannot write to
> > FUSE filesystems so filesystem freezing of FUSE would block if
> > userspace is already suspended. You may even have a setup like:
> > 
> > bdev <- fs <- FUSE filesystem <- loopback file <- loop device <-
> > another fs
> > 
> > So you really have to be careful to freeze this stack without
> > causing deadlocks. So you need to be freezing userspace after
> > filesystems are frozen but then you have to deal with the fact that
> > parts of your userspace will be blocked in the kernel (trying to do
> > some write) waiting for the filesystem to thaw. But it might be
> > tractable these days since I have a vague recollection that system
> > suspend is now able to gracefully handle even tasks in
> > uninterruptible sleep.
> 
> I thought we largely solved this problem with userspace flusher
> threads being able to call prctl(PR_IO_FLUSHER) to tell the kernel
> they are part of the IO stack and so need to be considered
> special from the POV of memory allocation and write (dirty page)
> throttling.
> 
> Maybe hibernate needs to be aware of these userspace flusher
> tasks and only suspend them after filesystems are frozen instead
> of when userspace is initially halted?

I can confirm it's not.  Its check for kernel thread is in
kernel/power/process.c:try_to_freeze_tasks().  It really only uses the
PF_KTHREAD flag in differentiating between user and kernel threads.

But what I heard in the session was that we should freeze filesystems
before any tasks because that means tasks touching the frozen fs freeze
themselves.

Regards,

James


  reply	other threads:[~2025-03-24 21:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0a76e074ef262ca857c61175dd3d0dc06b67ec42.camel@HansenPartnership.com>
     [not found] ` <Z9xG2l8lm7ha3Pf2@infradead.org>
     [not found]   ` <acae7a99f8acb0ebf408bb6fc82ab53fb687559c.camel@HansenPartnership.com>
2025-03-21  5:23     ` [LSF/MM/BPF TOPIC] Filesystem Suspend Resume Christoph Hellwig
2025-03-21 12:34       ` James Bottomley
2025-03-21 17:00         ` James Bottomley
2025-03-21 17:17           ` Lukas Wunner
2025-03-21 18:20             ` James Bottomley
2025-03-24 11:38           ` [Lsf-pc] " Jan Kara
2025-03-24 14:34             ` James Bottomley
2025-03-24 19:28               ` Jan Kara
2025-03-27 14:55                 ` Eric Sandeen
2025-03-27 17:30                   ` Jan Kara
2025-03-24 20:56               ` Dave Chinner
2025-03-24 20:50             ` Dave Chinner
2025-03-24 21:02               ` James Bottomley [this message]
2025-03-24 21:07                 ` Dave Chinner
2025-03-25 13:42                   ` Jan Kara
2025-03-26  2:36                     ` James Bottomley
2025-03-26 14:59                       ` Jan Kara
2025-03-26 15:25                         ` James Bottomley
2025-03-27 14:28                           ` James Bottomley

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=7f3eddf89f8fd128ffeb643bc582e45a7d13c216.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=len.brown@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.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