View previous topic :: View next topic |
Author |
Message |
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Jun 15, 2007 10:48 pm Post subject: suspend2-sources: how much swap needed for ram |
|
|
Hi
I have
Linux notebook 2.6.21-suspend2-r6_40 #1 Thu Jun 14 00:12:09 CEST 2007 x86_64 AMD Turion(tm) 64 Mobile Technology MT-34 AuthenticAMD GNU/Linux
1 GB RAM, now 1 GB swap
I have random lockups of my system, if too much applications are running.
Basically I know that I should have at least 2 GB of Swap. So how much swap should i make? |
|
Back to top |
|
|
warrawarra Tux's lil' helper
Joined: 30 May 2007 Posts: 84
|
Posted: Fri Jun 15, 2007 11:08 pm Post subject: |
|
|
Didyabringabeeralongmate.
swap = double ram amount but more than 2gb swap is not necesary but purely nice to have.
Too much apps with more ram or swap will still lockup depending on cpu usage.
gkrellms ?
any idea how much load is on your cpu ?
make.conf might need fine tunning :
make sure "-j3 -s" is there for makeopts as it is "cpu core + 1" to be safe.
-march=k8 ? -pipe -O2 is also good for compiling. capital O not zero.
Next try to see how much load is on your HD.
gkrellms works nicely to monitor this.
Search the forums as you can for the time also add to fstab the commit=60 option and will dedicate high transfers to be priority = bit more speed or feel like it.
Best thing is to monitor cpu load as this will cause a slow down if too much stuff is running. Lastly keep the laptop nice and cool / windy as temps can go very high 90C = dangerous for cpu so only 1 or max 2 compiles at one time.
Hope this helps. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sat Jun 16, 2007 12:21 am Post subject: |
|
|
hi, thx for your answer.
I have only a single core amd64, so I think my make.conf should be right.
Code: | notebook roman # cat /etc/make.conf
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CHOST="x86_64-pc-linux-gnu"
# Fuer einen Turion 64 Bit; http://gentoo-wiki.com/Safe_Cflags#Opteron.2FAthlon64_.28AMD.29
CFLAGS="-march=athlon64 -O2 -msse3 -pipe"
CXXFLAGS="${CFLAGS}"
#NEU
MAKEOPTS="-j2"
USE="3dnow 3dnowext 7zip X a52 aac ace acpi aiglx alsa amazon amd amr apm \
arj audiofile automount bash-completion bc bindist binfilter \
blender-game bluetooth bzip2 cairo caps cddb cdparanoia cdr cdrom \
clamav cpudetection css curl dbus dc1394 de_tvtoday device-mapper dga \
dhcp dia directfb divx dmi dmx dnotify dts dv dvd dvdnav dvdr dvdread \
eds emacs emerald enca encode esd evo exif expat extrafilters fam fame \
fat fbcon ffmpeg firefox flac flood fping ftp fuse gd ggi gif gimp \
gimpprint glib glitz gmp gnome gnome-print gnutls gpac graphviz gs \
gstreamer gtk gtkhtml guile gzip h323 hal hdaps hddtemp html http ibam \
id3 idea ieee1394 imagemagick imap imlib inkjar irda jack java \
javascript jpeg jpeg2k ladspa lame lcd lcms ldap libcaca libgda \
libnotify libsamplerate libsexy libwww lua lzo macmenu mad matroska \
maya-shaderlibrary mbox md5sum metalink mikmod mime mjpeg mmxext mng \
mod modplug mods mono moznocompose moznoirc moznomail moznopango mp2 \
mp3 mp4 mp4live mpeg mpeg2 mpi mplayer mule musepack musicbrainz \
nautilus neXt network new-login nfs nntp no-htdocs no-old-linux nodrm \
normalize nsplugin ntfs oav ogg openexr opengl osc oss pango pcmcia pdf \
physfs pmu png pnm pop portaudio postscript ppds prelude pwdb qt3 \
qt3support qt4 quicktime rar realmedia recode roe rsvg samba sasl sdl \
sdl-image sdl-sound seamonkey servletapi sndfile snmp sockets sox speex \
spell startup-notification stream streamripper subtitles svg swat sysfs \
syslog tagwriting tcl teamarena tga theora threads threadsafe \
threadsonly tiff tk transcode truetype twolame urandom usb utempter v4l \
v4l2 vcd vlm vorbis widescreen wifi wireshark wma wmf wmp wnck wordexp \
wxwindows x264 xanim xatrix xcomposite xext xine xinerama xml xpm \
xrandr xscreensaver xv xvid xvmc xvnc yaepg yv12 zip -berkdb -cli -gdbm \
-ipv6 -isdnlog -nls -reflection -spl -tcpd"
#use the closed source ATI drivers for my x700 card
VIDEO_CARDS="fglrx v4l"
#VIDEO_CARDS="radeon"
#set needed input devices for xorg-server
INPUT_DEVICES="evdev mouse keyboard wacom"
#synaptics"
#sprachen
LINGUAS="en en_GB"
LC_ALL="en_GB"
LANGUAGE="en_GB"
#neu, laedt bei emerge command alles parallel herunter im hintergrund
FEATURES="parallel-fetch"
#English is the best
LANG="en_GB en"
GENTOO_MIRRORS="http://mirror.switch.ch/mirror/gentoo/ http://gentoo.inode.at/ http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
#layman portage overlay, according to http://wiki.gentoo-xeffects.org/Overlay
#overlay for the xeffects overlay, e.g. beryl
#PORTDIR_OVERLAY="/usr/local/layman/xeffects"
#overlay for the sunrise overlay, e.g. fs-lint
#PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/portage/local/layman/gnome-experimental"
#my own overlay for e.g. razertool
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/layman/myownoverlay"
#PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/layman/sunrise"
source /usr/portage/local/layman/make.conf
CONFIG_PROTECT="/usr/share/hddtemp"
notebook roman #
|
i have searched the net for an explanation, its in german, so no problem for me http://forum.ubuntuusers.de/viewtopic.php?p=737858#737858
Quote: | Es gibt noch die Mount-Option "commit=<sec>". Damit wird auch die Festplattenaktivität geregelt, bzw. in welcher Zeit Daten auf die Platte geschrieben werden. Standardmäßig ist die wohl auf "5" (Sekunden). Kannst du ruhig mal auf "15" oder "30" stellen. |
|
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sat Jun 16, 2007 12:34 am Post subject: |
|
|
here is my
Code: | notebook roman # cat /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#
#file modified according to new Samsung Drive; 120GB; Tue_27.02.2007
# <fs> <mountpoint> <type> <opts> <dump/pass>
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1 /boot ext2 noatime,commit=60 1 2
/dev/hda7 /mnt/Daten ntfs-3g locale=de_DE.UTF-8 0 0
/dev/hda2 /mnt/windows ntfs-3g 0 0
/dev/hda5 / ext3 noatime,commit=60 0 1
/dev/hdc /mnt/cdrom auto noauto,user 0 0
/dev/hda8 /home ext3 noatime,commit=60 0 1
# NOTE: The next line is critical for boot!
proc /proc proc defaults 0 0
# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
#1 GB Swap Partition
/dev/hda6 none swap sw 0 0
notebook roman #
|
|
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Sat Jun 16, 2007 1:27 am Post subject: |
|
|
I run suspend2 sources on a laptop with 1gb swap 1gb ram. I personally never crossed the 1gb threshold in ram to have it overflow, but I'd say put a monitor on your desktop so you can see how much memory is in use before closing the lid. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sat Jun 16, 2007 10:09 am Post subject: |
|
|
This only occurs when I compile openoffice with nice 20 and play tremulous; shutdown tremulous and hibernate my machine. |
|
Back to top |
|
|
KShots Guru
Joined: 09 Oct 2003 Posts: 595 Location: Florida
|
Posted: Mon Jul 30, 2007 1:34 pm Post subject: |
|
|
If I understand correctly, the point of having swap in a suspend2 kernel is to be able to suspend your RAM to the swap... which means you want exactly as much swap as you have RAM, and you want to make sure that the swap is NOT used until you suspend. Alternatively, you can have multiple swap partitions, in which case I'd recommend your actual swap be double your RAM.
I've got a machine where I'm considering using a suspend2 kernel, and I intend to have NO mounted swap as I'm running entirely on flash memory (and as flash has a limited number of writes before it dies, I definately do NOT want to use it as swap). _________________ Life without passion is death in disguise |
|
Back to top |
|
|
Evincar Apprentice
Joined: 13 Feb 2007 Posts: 217 Location: Madrid
|
Posted: Mon Jul 30, 2007 2:39 pm Post subject: |
|
|
Swap=RAM should suffice with suspend2. Reason being, suspend2 uses the LZF algorithm (make sure it is in your kernel!), that can easily compress the image by 35% at least, sometimes even as much as 60%. _________________ <@Chin^> My sister caught me jacking off the other week and calls me a pervert
<@Chin^> just the other day i walked into my room and caught my sister masturbating
<@Chin^> So she calls me a pervert again?!?
<@Chin^> there is no justice in the world... |
|
Back to top |
|
|
KShots Guru
Joined: 09 Oct 2003 Posts: 595 Location: Florida
|
Posted: Mon Jul 30, 2007 3:15 pm Post subject: |
|
|
Alright... maybe I'm a bit confused. Why would you need compression on a swap=RAM partition? Wouldn't you just dump the CPU cache + registers to RAM, then dump RAM to swap and hibernate? The compression just seems like a complicated extra step for no purpose. _________________ Life without passion is death in disguise |
|
Back to top |
|
|
RoundsToZero Guru
Joined: 17 Nov 2003 Posts: 478 Location: New York, NY
|
Posted: Mon Jul 30, 2007 7:55 pm Post subject: |
|
|
Sure, if you're not using any swap. Or if you have 2 GB of RAM and then you don't need much swap for regular use (I have 1 GB).
Compression is not complicated and LZF still runs faster than hibernate on Windows XP so I'm not sure what your problem is. But you can disable it if you insist.
What I've heard is swap = RAM times 2 but no greater than 1 GB. I almost never use swap during regular operation but my suspend images regularly approach the 1 GB mark. However that's mostly disk caches (which are nice to have restored when you resume) and suspend2 will automatically trim the disk cache so that it'll never try to save more than the max swap you have available to write to.
Usually my actual RAM usage (non cache) is well under 1 GB so technically I wouldn't need compression. But like I said it's nice to have the disk cache restored when you resume. |
|
Back to top |
|
|
KShots Guru
Joined: 09 Oct 2003 Posts: 595 Location: Florida
|
Posted: Mon Jul 30, 2007 8:02 pm Post subject: |
|
|
But what happens if you hibernate when you are using both RAM and swap? You can't flush your RAM to swap if you're already using some of your swap. You really need a dedicated swap partition used only for for hibernation, along with possibly another swap partition if you actually need swap for... well... swapping. The first should be exactly the size of your RAM + CPU cache + CPU registers (or perhaps a bit larger), and the second should follow the conventions you just described. I think my confusion is that we're not talking about the same swap partitions.
Take this case:
RAM: 1G
Swap: 1G
RAM in use 952M
Swap in use: 703M
hibernation call received, dump to disk... but wait, there's not enough space to hold the in-use swap + RAM + CPU cache + registers, even with compression. Now what?
Still, even in that case, I don't see the point of compression - just dump it, don't bother compressing it. _________________ Life without passion is death in disguise |
|
Back to top |
|
|
Evincar Apprentice
Joined: 13 Feb 2007 Posts: 217 Location: Madrid
|
Posted: Mon Jul 30, 2007 9:17 pm Post subject: |
|
|
KShots wrote: | But what happens if you hibernate when you are using both RAM and swap? You can't flush your RAM to swap if you're already using some of your swap. You really need a dedicated swap partition used only for for hibernation, along with possibly another swap partition if you actually need swap for... well... swapping. The first should be exactly the size of your RAM + CPU cache + CPU registers (or perhaps a bit larger), and the second should follow the conventions you just described. I think my confusion is that we're not talking about the same swap partitions.
Take this case:
RAM: 1G
Swap: 1G
RAM in use 952M
Swap in use: 703M
hibernation call received, dump to disk... but wait, there's not enough space to hold the in-use swap + RAM + CPU cache + registers, even with compression. Now what?
Still, even in that case, I don't see the point of compression - just dump it, don't bother compressing it. |
Compression actually speeds up the proccessbecause the LZF algorithm is so quick that it can (un)compress the data fast enough to saturate the disk writing (reading) speed. So the usual 40 MB/s reading speed actually becomes close to 80 with the compression.
In the case you are picturing, it may still be possible to get that fit into swap, as 50% compression isn't rare at all. And even if it is not, suspend2 will simply delete some cache stuff, as roundtozero pointed out. If those figures of memory usage are without cache, then something is horribly wrong with your system _________________ <@Chin^> My sister caught me jacking off the other week and calls me a pervert
<@Chin^> just the other day i walked into my room and caught my sister masturbating
<@Chin^> So she calls me a pervert again?!?
<@Chin^> there is no justice in the world... |
|
Back to top |
|
|
adsmith Veteran
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Mon Jul 30, 2007 9:20 pm Post subject: |
|
|
In suspend2, you can designate a maximum amount of page cache to save, so it will throw out stale pages sitting in swap.
In the event that you are hitting 2G mem AND swap for active memory, well -- you have other problems. |
|
Back to top |
|
|
anton_kg Tux's lil' helper
Joined: 10 Feb 2007 Posts: 93
|
Posted: Mon Jul 30, 2007 11:25 pm Post subject: |
|
|
Don't forget you can suspend to a file too. You'll loose extra space, of cause, but this is safer at least.
That could be a good option after memory upgrade for example, then you don't have enough swap space. |
|
Back to top |
|
|
KShots Guru
Joined: 09 Oct 2003 Posts: 595 Location: Florida
|
Posted: Tue Jul 31, 2007 12:42 pm Post subject: |
|
|
It really depends on what you're doing with your system. If you're idling and you hit that point, you're right - something's seriously wrong. If you're working on several different intensive applications and hit that point, I can easily see it close to the thrashing point (full swap, full RAM), which leaves no room at all for hibernation.
As far as compression, Ok I'll admit you have me convinced. Wouldn't that I/O efficiency depend on the CPU, though? I can easily imagine that being true for a P4 or better CPU... what about a Via C7 at 1.2 GHz? (That's my target machine for a suspend2-style kernel).
EDIT: Also, are there any options for preserving video RAM? Say you're working with a 3D modeler and your battery runs low and goes into hibernation. How would you recover? In my own case I have a PCI video card with 256M to save (so slow transfer rate for a dump / reload). In my own application, it will constantly be running a 3D app, so will always be hibernating with video RAM to save... or I'll have to run a script to kill and reload the 3D app on resuming from hibernation. _________________ Life without passion is death in disguise |
|
Back to top |
|
|
|