Skip to contentSkip to conversation

Linux hibernation

DISCUSSION Jacky Lam 5 participants 10 messages Mar 14, 2011 – Mar 17, 2011

lore
Share & tools
lore

Jacky Lam

author
#0 lore raw

Hi all,

I am looking at the source code 2.6.29 and find that Linux will
make a copy of used memory pages when doing hibernation. I am curious, in this case, what Linux do if I have used over 50% of memory? Will hibernation just fail? I think it is not possible, but I can't understand from the code.

Could any explain a little bit for me? Thanks.

Jacky

#1 lore raw
Quoted 4 lines

? ? I am looking at the source code 2.6.29 and find that Linux will make a copy of used memory pages when doing hibernation. I am curious, in this case, what Linux do if I have used over 50% of memory? Will hibernation just fail? I think it is not possible, but I can't

I have seen hibernation fail on my laptop if I have a lot of applications open (evolution/empathy). Then if I close these apps and hibernate again...it works. So yes, I think it can fail if it doesn't have enough RAM available.

HTH,
-mandeep

Quoted 11 lines

understand from the code.

? ? Could any explain a little bit for me? Thanks.

Jacky

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#2 lore raw

2011/3/14 Mandeep Sandhu <[email protected]>:

Quoted 10 lines
Quoted 4 lines

? ? I am looking at the source code 2.6.29 and find that Linux will make a copy of used memory pages when doing hibernation. I am curious, in this case, what Linux do if I have used over 50% of memory? Will hibernation just fail? I think it is not possible, but I can't

I have seen hibernation fail on my laptop if I have a lot of applications open (evolution/empathy). Then if I close these apps and hibernate again...it works. So yes, I think it can fail if it doesn't have enough RAM available.

You mean swap place right. I had similar failures over small swap space because I had way too much things open on my computer.

Signature · 1 line
Ozan, BSc, BEng
#3 lore raw
In reply to Mandeep Sandhu

Hello Mandeep Sandhu,

Am 2011-03-14 15:50:32, hacktest Du folgendes herunter:

Quoted 4 lines

I have seen hibernation fail on my laptop if I have a lot of applications open (evolution/empathy). Then if I close these apps and hibernate again...it works. So yes, I think it can fail if it doesn't have enough RAM available.

It fail, if you have used the whole RAM, Linux already consuming the SWAP and you want to use the SWAP Partition as Hybernation-Storage.

Thanks, Greetings and nice Day/Evening
Michelle Konzack

Signature · 26 lines
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems at tdnet France EURL       itsystems at tdnet UG (limited liability)
Owner Michelle Konzack            Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz                 Kinzigstra?e 17
67100 Strasbourg/France           77694 Kehl/Germany
Tel: +33-6-61925193 mobil         Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4michelle at jabber.ccc.de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110314/5df4f719/attachment.bin 
#4 lore raw
Quoted 8 lines

Am 2011-03-14 15:50:32, hacktest Du folgendes herunter:

Quoted 4 lines

I have seen hibernation fail on my laptop if I have a lot of applications open (evolution/empathy). Then if I close these apps and hibernate again...it works. So yes, I think it can fail if it doesn't have enough RAM available.

It fail, if you have used the whole RAM, ?Linux ?already ?consuming ?the SWAP and you want to use the SWAP Partition as Hybernation-Storage.

Hmmm. I have a pretty big swap partition ~ 4 GB. I'm not sure if that was completely used when hibernate failed.

Will take a note of 'free' o/p before doing a hibernate and see if both RAM and swap are full or not.

Right now I'm running a full load and the swap is hardly used.

$ free -m
             total       used       free     shared    buffers     cached
Mem:          2885       2635        249          0        236       1402
-/+ buffers/cache:        997       1887
Swap:         3813        372       3441

I'll see if with this load, hibernate fails or not.

-mandeep

Quoted 31 lines

Thanks, Greetings and nice Day/Evening
? ?Michelle Konzack

--
##################### Debian GNU/Linux Consultant ###################### ? Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems at tdnet France EURL ? ? ? itsystems at tdnet UG (limited liability) Owner Michelle Konzack ? ? ? ? ? ?Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz ? ? ? ? ? ? ? ? Kinzigstra?e 17 67100 Strasbourg/France ? ? ? ? ? 77694 Kehl/Germany
Tel: +33-6-61925193 mobil ? ? ? ? Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/> ?<http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/> ? ? ? ? <http://www.can4linux.org/>

Jabber linux4michelle at jabber.ccc.de
ICQ ? ?#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#5 lore raw

Hello Mandeep Sandhu,

Am 2011-03-14 18:02:56, hacktest Du folgendes herunter:

Quoted 2 lines

Hmmm. I have a pretty big swap partition ~ 4 GB. I'm not sure if that was completely used when hibernate failed.

OK your system has 3 GByte of memory with 4 GByte of SWAP.

Quoted 5 lines

Will take a note of 'free' o/p before doing a hibernate and see if both RAM and swap are full or not.

Right now I'm running a full load and the swap is hardly used.

Quoted 7 lines
$ free -m
             total       used       free     shared    buffers     cached
Mem:          2885       2635        249          0        236       1402
-/+ buffers/cache:        997       1887
Swap:         3813        372       3441

I'll see if with this load, hibernate fails or not.

You have 2,75 GByte of Memory + 256 MByte of Graphic Ram right?

If your system use the the SWAP partition to hybernate, then it will fail, because it has to do a "swapoff" and write the contents of the SWAP to memory.

In clear, you are currently using

4096 MByte RAM + 374 MByte SWAP - 249 MByte Free

= 4221 MByte = 4,12 GByte

which is to much o fit into memory.

Quoted 1 line

-mandeep

Thanks, Greetings and nice Day/Evening
Michelle Konzack

Signature · 26 lines
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems at tdnet France EURL       itsystems at tdnet UG (limited liability)
Owner Michelle Konzack            Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz                 Kinzigstra?e 17
67100 Strasbourg/France           77694 Kehl/Germany
Tel: +33-6-61925193 mobil         Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4michelle at jabber.ccc.de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110315/c1715a23/attachment.bin 
#6 lore raw
Quoted 6 lines · Michelle Konzack

You have 2,75 GByte of Memory + 256 MByte of Graphic Ram right?

If your system use the the SWAP partition to ?hybernate, ?then ?it ?will fail, because it has to do a "swapoff" and write ?the ?contents ?of ?the SWAP to memory.

Quoted 7 lines

In clear, you are currently using

? ?4096 MByte RAM + 374 MByte SWAP - 249 MByte Free

? ?= 4221 MByte = 4,12 GByte

which is to much o fit into memory.

hm, CMIIW, but I think you also count page cache above...that's discardable...i.e kernel will push them back into backing disc... so, they're not really counted... only anonymous pages, locked pages and similar ones which is swaped out...

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
author
#7 lore raw
Quoted 12 lines · Mulyadi Santosa
Quoted 10 lines · Michelle Konzack

You have 2,75 GByte of Memory + 256 MByte of Graphic Ram right?

If your system use the the SWAP partition to hybernate, then it will fail, because it has to do a "swapoff" and write the contents of the SWAP to memory.

In clear, you are currently using

4096 MByte RAM + 374 MByte SWAP - 249 MByte Free

Quoted 8 lines
Quoted 3 lines
    = 4221 MByte = 4,12 GByte

which is to much o fit into memory.

hm, CMIIW, but I think you also count page cache above...that's discardable...i.e kernel will push them back into backing disc... so, they're not really counted... only anonymous pages, locked pages and similar ones which is swaped out...

Some pages that are not necessary to be saved are also counted.
This can be proved by doing :

echo 3 > /proc/sys/vm/drop_caches

before you hibernate. You can get smaller image size after that.

Jacky

#8 lore raw
In reply to Michelle Konzack
Quoted 3 lines
Quoted 1 line

I'll see if with this load, hibernate fails or not.

You have 2,75 GByte of Memory + 256 MByte of Graphic Ram right?

correct.

Quoted 8 lines

If your system use the the SWAP partition to ?hybernate, ?then ?it ?will fail, because it has to do a "swapoff" and write ?the ?contents ?of ?the SWAP to memory.

In clear, you are currently using

? ?4096 MByte RAM + 374 MByte SWAP - 249 MByte Free

you mean 372MB of swap is used (not 374 MB?).

Quoted 4 lines

? ?= 4221 MByte = 4,12 GByte

which is to much o fit into memory.

How did you arrive at 4096 MB figure? Are you adding the currently used mem + cached pages?

-mandeep

Quoted 33 lines
Quoted 2 lines

-mandeep

Thanks, Greetings and nice Day/Evening
? ?Michelle Konzack

--
##################### Debian GNU/Linux Consultant ###################### ? Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems at tdnet France EURL ? ? ? itsystems at tdnet UG (limited liability) Owner Michelle Konzack ? ? ? ? ? ?Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz ? ? ? ? ? ? ? ? Kinzigstra?e 17 67100 Strasbourg/France ? ? ? ? ? 77694 Kehl/Germany
Tel: +33-6-61925193 mobil ? ? ? ? Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/> ?<http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/> ? ? ? ? <http://www.can4linux.org/>

Jabber linux4michelle at jabber.ccc.de
ICQ ? ?#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#9 lore raw
In reply to Jacky Lam
Quoted 7 lines · Jacky Lam

Hi all,

? ? I am looking at the source code 2.6.29 and find that Linux will make a copy of used memory pages when doing hibernation. I am curious, in this case, what Linux do if I have used over 50% of memory? Will hibernation just fail? I think it is not possible, but I can't understand from the code.

based on my experience, hibernation fails if swap can't hold the total size of anonymous pages plus certain kind of pages (such as mlock()-ed one, slab etc etc).

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com