mbox

[stable] PM / Hibernate: Hibernate/thaw fixes/improvements

Message ID alpine.DEB.2.02.1207111607040.3768@lazy
State New
Headers show

Pull-request

git://kernel.ubuntu.com/manjo/ubuntu-precise.git for-upstream

Message

Manoj Iyer July 11, 2012, 9:08 p.m. UTC
Please consider the following upstream patch to stable 3.2.y linux-stable

Patch:  PM / Hibernate: Hibernate/thaw fixes/improvements

commit 5a21d489fd9541a4a66b9a500659abaca1b19a51
Author: Bojan Smojver <bojan@rexursive.com>
Date:   Sun Apr 29 22:42:06 2012 +0200

     PM / Hibernate: Hibernate/thaw fixes/improvements

      1. Do not allocate memory for buffers from emergency pools, unless
         absolutely required. Do not warn about and do not retry non-essential
         failed allocations.

      2. Do not check the amount of free pages left on every single page
         write, but wait until one map is completely populated and then check.

      3. Set maximum number of pages for read buffering consistently, instead
         of inadvertently depending on the size of the sector type.

      4. Fix copyright line, which I missed when I submitted the hibernation
         threading patch.

      5. Dispense with bit shifting arithmetic to improve readability.

      6. Really recalculate the number of pages required to be free after all
         allocations have been done.

      7. Fix calculation of pages required for read buffering. Only count in
         pages that do not belong to high memory.

     Signed-off-by: Bojan Smojver <bojan@rexursive.com>
     Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>


This patch fixes S4 issues on Lenovo and thinkpad models. The patch applies
cleanly to:
git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-3.2.y.git
tree. and the patch was tested on Ubuntu precise by me on Lenovo system.

----------------------------------------------------------------
The following changes since commit bb05f28f3de03fcb1297f1a48d8132c4bdd929e3:

   PM / Hibernate: Hibernate/thaw fixes/improvements (2012-07-11 21:46:06 +0100)
are available in the git repository at:

   git://kernel.ubuntu.com/manjo/ubuntu-precise.git for-upstream

for you to fetch changes up to bb05f28f3de03fcb1297f1a48d8132c4bdd929e3:

   PM / Hibernate: Hibernate/thaw fixes/improvements (2012-07-11 21:46:06 +0100)

----------------------------------------------------------------

Thanks


--
====================
Manoj Iyer
Ubuntu/Canonical
Hardware Enablement
====================

Comments

Ben Hutchings July 13, 2012, 2:16 a.m. UTC | #1
On Wed, 2012-07-11 at 16:08 -0500, Manoj Iyer wrote:
> Please consider the following upstream patch to stable 3.2.y linux-stable
>
> Patch:  PM / Hibernate: Hibernate/thaw fixes/improvements
> 
> commit 5a21d489fd9541a4a66b9a500659abaca1b19a51
> Author: Bojan Smojver <bojan@rexursive.com>
> Date:   Sun Apr 29 22:42:06 2012 +0200
> 
>      PM / Hibernate: Hibernate/thaw fixes/improvements
> 
>       1. Do not allocate memory for buffers from emergency pools, unless
>          absolutely required. Do not warn about and do not retry non-essential
>          failed allocations.
> 
>       2. Do not check the amount of free pages left on every single page
>          write, but wait until one map is completely populated and then check.
> 
>       3. Set maximum number of pages for read buffering consistently, instead
>          of inadvertently depending on the size of the sector type.
> 
>       4. Fix copyright line, which I missed when I submitted the hibernation
>          threading patch.
> 
>       5. Dispense with bit shifting arithmetic to improve readability.
> 
>       6. Really recalculate the number of pages required to be free after all
>          allocations have been done.
> 
>       7. Fix calculation of pages required for read buffering. Only count in
>          pages that do not belong to high memory.
> 
>      Signed-off-by: Bojan Smojver <bojan@rexursive.com>
>      Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

I don't know about this.  It sounds like it's making a lot of different
changes, not all of which are that important.  But perhaps this is just
a verbose description of a single logical change (it's certainly not a
very large change).

> This patch fixes S4 issues on Lenovo and thinkpad models. The patch applies
> cleanly to:
> git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-3.2.y.git
> tree. and the patch was tested on Ubuntu precise by me on Lenovo system.
[...]

I wonder why it would fix these specific systems, as there's nothing
obviously hardware-specific there.  Or, it fixes those, whether it might
at the same time cause regressions for other systems.

Bojan, can you comment on whether you think this meets the stable update
criteria?

Ben.
Bojan Smojver July 13, 2012, 2:52 a.m. UTC | #2
On Fri, 2012-07-13 at 03:16 +0100, Ben Hutchings wrote:
> On Wed, 2012-07-11 at 16:08 -0500, Manoj Iyer wrote:
> > Please consider the following upstream patch to stable 3.2.y linux-stable
> >
> > Patch:  PM / Hibernate: Hibernate/thaw fixes/improvements
> > 
> > commit 5a21d489fd9541a4a66b9a500659abaca1b19a51
> > Author: Bojan Smojver <bojan@rexursive.com>
> > Date:   Sun Apr 29 22:42:06 2012 +0200
> > 
> >      PM / Hibernate: Hibernate/thaw fixes/improvements
> > 
> >       1. Do not allocate memory for buffers from emergency pools, unless
> >          absolutely required. Do not warn about and do not retry non-essential
> >          failed allocations.

We drops KERN_HIGH from page allocation request and tells the allocator
not to retry and not to warn us about failed allocations. These are
buffers being allocated that are good for speed, but not essential, so
we do not want to put unnecessary pressure on the memory system with
these allocations.

> >       2. Do not check the amount of free pages left on every single page
> >          write, but wait until one map is completely populated and then check.

This waits until one map is full before checking how much memory is left
and forcing a flush. Just a touch faster.

> >       3. Set maximum number of pages for read buffering consistently, instead
> >          of inadvertently depending on the size of the sector type.

On some systems, sector size is 8 bytes, on some 4. So, instead of using
that in calculations and getting different result for the number of
pages for buffering, we just define a constant.

> >       4. Fix copyright line, which I missed when I submitted the hibernation
> >          threading patch.

Does nothing. :-)

> >       5. Dispense with bit shifting arithmetic to improve readability.

Does nothing. :-)

> >       6. Really recalculate the number of pages required to be free after all
> >          allocations have been done.

Moves free page calculation after all threads have been started, to get
the a more realistic picture. Should not make a big difference, but it
is more correct than previous code (which was really a cut and paste to
a slightly wrong place).

> >       7. Fix calculation of pages required for read buffering. Only count in
> >          pages that do not belong to high memory.

This may make a difference on systems where low memory is very tight on
thaw. So, we make sure we never rely on high memory (which cannot be
used for this) in the calculations.

> >      Signed-off-by: Bojan Smojver <bojan@rexursive.com>
> >      Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> 
> I don't know about this.  It sounds like it's making a lot of different
> changes, not all of which are that important.  But perhaps this is just
> a verbose description of a single logical change (it's certainly not a
> very large change).

Correct. Just minor cleanups.

> > This patch fixes S4 issues on Lenovo and thinkpad models. The patch applies
> > cleanly to:
> > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-3.2.y.git
> > tree. and the patch was tested on Ubuntu precise by me on Lenovo system.
> [...]
> 
> I wonder why it would fix these specific systems, as there's nothing
> obviously hardware-specific there.  Or, it fixes those, whether it might
> at the same time cause regressions for other systems.

I have a ThinkPad T510. I can hibernate/thaw without it and with it, but
this may depend on memory you have available on your machine. I
certainly hope it would not cause regressions, because it should be even
more careful about memory allocations than the present code.

> Bojan, can you comment on whether you think this meets the stable update
> criteria?

I hope so, yes. I wanted Rafael to include it in stable before, but he
asked me for a simpler patch instead.
Ben Hutchings July 19, 2012, 3:29 a.m. UTC | #3
On Fri, 2012-07-13 at 12:52 +1000, Bojan Smojver wrote:
> On Fri, 2012-07-13 at 03:16 +0100, Ben Hutchings wrote:
> > On Wed, 2012-07-11 at 16:08 -0500, Manoj Iyer wrote:
> > > Please consider the following upstream patch to stable 3.2.y linux-stable
> > >
> > > Patch:  PM / Hibernate: Hibernate/thaw fixes/improvements
> > > 
> > > commit 5a21d489fd9541a4a66b9a500659abaca1b19a51
> > > Author: Bojan Smojver <bojan@rexursive.com>
> > > Date:   Sun Apr 29 22:42:06 2012 +0200
> > > 
> > >      PM / Hibernate: Hibernate/thaw fixes/improvements
[...]
> > > This patch fixes S4 issues on Lenovo and thinkpad models. The patch applies
> > > cleanly to:
> > > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-3.2.y.git
> > > tree. and the patch was tested on Ubuntu precise by me on Lenovo system.
> > [...]
> > 
> > I wonder why it would fix these specific systems, as there's nothing
> > obviously hardware-specific there.  Or, it fixes those, whether it might
> > at the same time cause regressions for other systems.
> 
> I have a ThinkPad T510. I can hibernate/thaw without it and with it, but
> this may depend on memory you have available on your machine. I
> certainly hope it would not cause regressions, because it should be even
> more careful about memory allocations than the present code.

Yes, I understand that's what it tries to do.

> > Bojan, can you comment on whether you think this meets the stable update
> > criteria?
> 
> I hope so, yes. I wanted Rafael to include it in stable before, but he
> asked me for a simpler patch instead.

OK, I've added this to the queue.

Ben.