public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Paul Mackerras <paulus@samba.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	linux-pm@lists.linux-foundation.org, Pavel Machek <pavel@ucw.cz>
Subject: Re: shrinking memory for suspend?
Date: Fri, 4 May 2007 11:02:57 +0200	[thread overview]
Message-ID: <200705041102.57944.rjw@sisk.pl> (raw)
In-Reply-To: <17978.28914.736715.985306@cargo.ozlabs.ibm.com>

On Friday, 4 May 2007 01:32, Paul Mackerras wrote:
> Alan Stern writes:
> 
> > > > Which is why the powermac/powerbook sleep code insists on there only
> > > > being one cpu active.  I have an SMP powermac which can sleep; I use a
> > > > little script to take the second cpu down before sleeping and bring it
> > > > back up after waking up.
> > > 
> > > That's quite intrusive.  Ideally, user space processes should not notice that
> > > there have been a suspend at one point.
> > 
> > What happens without preemption enabled when a device driver's suspend() 
> > method calls schedule()?
> 
> That would be bad; don't do that. :)
> 
> In the context of the original powermac sleep code, drivers registered
> a notifier for sleep which got called twice - the first time before
> doing the sync, and the second time after it, with an argument to the
> notifier to indicate which call this is.  Drivers are allowed to call
> schedule on the first call but not on the second.
> 
> > With or without preemption enabled, what happens when a user process tries
> > to do I/O to a suspended device?
> 
> If we have two calls to the driver, then the second one should happen
> with only one cpu still active and preemption disabled, and that's the
> call where the device hardware should actually be put into its suspend
> state.
> 
> I'm not saying the original powermac code was perfect, but it does
> work well for many users using powerbooks (which are all single-cpu
> machines), without freezing processes.
> 
> I can see the attraction of the freezer, but there are still at least
> three problems with it AFAICS:
> 
> * Working out which kernel threads should *not* be frozen is a manual,
>   difficult and error-prone process
> * Putting processes into an uninterruptible sleep stuffs up the load
>   average

This is fixable, I think.

> * It's intrusive in the sense that every kernel thread needs to have
>   code in it to allow it to be frozen, and not all the kernel thread
>   main loops have been "fixed".

IMO, the freezing of user space and the freezing of kernel threads are two
different issues.  While the freezing of user space is pretty straightforward,
the freezing of kernel threads is difficult.

OTOH, it turns out that the freezer is also useful for other purposes, like
kprobes and the CPU hotplug (yes, yes), so the infrastructure needed by it
is no longer suspend-specific.  Since we have the infrastructure (needed for
other purposes anyway), we can use it just fine.

Of course, the problem of working out which kernel threads should not be
frozen for the suspend is real.

Greetings,
Rafael

  reply	other threads:[~2007-05-04  9:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 14:24 shrinking memory for suspend? Johannes Berg
2007-04-30 15:09 ` Alan Stern
2007-04-30 15:10 ` Rafael J. Wysocki
2007-04-30 15:09   ` Johannes Berg
2007-04-30 19:57     ` Rafael J. Wysocki
2007-05-02 11:29 ` Pavel Machek
2007-05-02 14:02   ` Johannes Berg
2007-05-03 10:17     ` Rafael J. Wysocki
2007-05-03 10:34       ` Paul Mackerras
2007-05-03 10:45         ` Rafael J. Wysocki
2007-05-03 12:51           ` Paul Mackerras
2007-05-03 13:15             ` Rafael J. Wysocki
2007-05-03 16:34             ` Pavel Machek
2007-05-03 14:34           ` Alan Stern
2007-05-03 16:39             ` Rafael J. Wysocki
2007-05-03 23:32             ` Paul Mackerras
2007-05-04  9:02               ` Rafael J. Wysocki [this message]
2007-05-04 10:49                 ` Paul Mackerras
2007-05-04 12:11                   ` Rafael J. Wysocki
2007-05-04 15:05               ` Alan Stern
2007-05-03 11:33       ` Johannes Berg
2007-05-03 12:56         ` Rafael J. Wysocki
2007-05-04 10:48           ` Johannes Berg

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=200705041102.57944.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=johannes@sipsolutions.net \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=paulus@samba.org \
    --cc=pavel@ucw.cz \
    /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