Reply
Thread Tools
Posts: 309 | Thanked: 456 times | Joined on Jan 2010
#1
This is relevant to Easy Debian and general faster operation of maemo, so I thought this needed a separate thread in order to discuss the best methods..

I have been reading about using SDCard partition for swap in
the Easy Debian Thread - http://talk.maemo.org/showthread.php?t=34550&page=271

Based of what I have seen, there are some tweaks by freemangordon and Estel tweaking overall swap settings I'd like to make permanent.
I'd also like to apply the SDCard swap during startup

What is the best method for this? Is it better to create a startup script in /etc/event.d, or is there an existing file to modify?
If so - how do you apply the changes?

Is striping swap across sdcard and emmc the best method, or is single swap on sdcard the better way to go?

Last edited by [DarkGUNMAN]; 2012-05-16 at 07:14.
 

The Following 3 Users Say Thank You to [DarkGUNMAN] For This Useful Post:
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#2
Single swap on SD card is definitely better way to go, as it don't create I/O conflicts between Maemo /home/ and swap. It's even better than stripping swap between eMMc and SD card - speed benefits are quite a myth, as conflicts eat any benefit + add overhead (flash media doesn't handle many independent request very efficiently).

As for method of setting it permanently - script in /etc/event.d isn't bad thing - especially, that in case of problems, there are methods (haven't tried myself) to delay executing such scripts. Ho ever, it makes boot slower, as - technically - Maemo first enable eMMC swap, then, due to our script, enable SD swap and disable eMMC swap. It's unnecessary operation.

So, best way, if You're absolutely sure that it's what You want, is to edit /etc/event.d/rcS-late, replacing line:
Code:
swapon -a
...with

Code:
swapon /dev/mmcblk1p2
...if Your swap partition is 2nd partition on SD card. In other case, modify /dev/mmcblk*p* accordingly, replacing * with correct numbers.

This way, swap on microSD is enabled during boot process without any additional overhead, and eMMC swap partition isn't used at all. You may reclaim it's space by repartitioning, or keep it as backup solution (I keep 100 MB backup swap on eMMC for purpose of "refreshing" swap partition, which I'll elaborate more later).

As for swap settings mentioned in thread linked in 1st post, [b]freemangordon[/]'s ones are surely more bleeding-edge - mine are more similar to stock settings, yet I'm very satisfied with results (I'm trying to find balance between freemangordon's ones and stock ones, and it seems to be that). Most of things set there can be edited by swappolube, although, not all of them. Remember, that setting them via echo modify it only until next reboot - to set it permanently, one should add it to some script in /etc/event.d/ (setting it here is much faster than enabling&disabling swap, so difference in booting time shouldn't be noticed), or do ti exactly as swappolube does it (how?).

That's the basics. Very important thing is preventing swap fragmentation via swap reflesh - I've modified shadowjk's scripts to make it bulletproof solution, and liked to publish it long time ago - well, IU hoped for doing it convenient way via a repos, but publishing here for pre-audit may be a good idea.

I'll post it and elaborate more about it on later time.

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!
 

The Following 22 Users Say Thank You to Estel For This Useful Post:
Posts: 1,397 | Thanked: 2,126 times | Joined on Nov 2009 @ Dublin, Ireland
#3
That would be a good option to add to Swappolluble so you can enable/disable swap on any existing partition from the UI.
 

The Following 5 Users Say Thank You to ivgalvez For This Useful Post:
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#4
It should be noted that if you do put swap on SD that you can under no circumstance take the back cover off when the swap is mounted on the SD. When you do this the MMC is insta-umounted with respect to no man.

To remove the back cover without moving swap back to emmc is like pulling a RAM chip from a running PC but worse. I have destroyed entire SD cards and completely corrupted my emmc beyond backup menus help by doing this.

It believe it is entirely possible to create a 'swapon SD/swapoff SD' entry in power menu 'systemui.xml' just by adding a few lines just like phone/tablet mode button thing.
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 17 Users Say Thank You to vi_ For This Useful Post:
Posts: 346 | Thanked: 271 times | Joined on Jan 2010
#5
About this: does someone know if this is done on the hardware side, or by the kernel (would be patchable) ?

And also what is the point of such behaviour: if at least the microsd was propely unmounted, that would be understandable, but that's not the case if I remember correctly.
 
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#6
Agree with vi_, + there is simple workaround, allowing to both have swap on microSD *and* ability to remove backcover - glue small magnet on place, where sensor expect it. It doesn't require *any* hardware skills, and works great. I'm using it for ages.

Of course, if You do so, never ever take out Your SD card without unmounting it (=also set swap somewhere else, at least temporal), but if You're messing with such settings as proposed in this thread, You know it already.

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!

Last edited by Estel; 2012-05-17 at 01:39.
 

The Following 5 Users Say Thank You to Estel For This Useful Post:
Posts: 1,163 | Thanked: 1,873 times | Joined on Feb 2011 @ The Netherlands
#7
Estel, I would be interested in your defragmentation script Also, swappolube creates a file in event.d called tuning, in case you didn't found out already

Are the proposed settings really the best? I found swapiness to 50 work better when receiving calls than set 30 rest I use proposed and a part of your settings found in ED thread.
 
Posts: 1,225 | Thanked: 1,905 times | Joined on Feb 2011 @ Quezon City, Philippines
#8
Originally Posted by Estel View Post
So, best way, if You're absolutely sure that it's what You want, is to edit /etc/event.d/rcS-late, replacing line:
Code:
swapon -a
...with

Code:
swapon /dev/mmcblk1p2
This is kinda risky - if you ever forget that the N900 now depends on a microsd on a specific partition for Swap, Maemo will start *****ing about not enough memory (not true, can launch xterm).

A better solution would be to replace swapon -a with the 'swapmicro' script posted somewhere here on TMO, which detects swap partitions on the microsd, and if it is available, uses that and doesnt bother with emmc. Otherwise, if there's no swap on microsd, it simply runs swapon -a.

I'll post my edits to rcS-late when I get back home.
__________________
N9 PR 1.3 Open Mode + kernel-plus for Harmattan
@kenweknot, working on Glacier for Nemo.
 
Posts: 372 | Thanked: 61 times | Joined on Jan 2012
#9
is it possible we can get more ram from 256 physical ram. I only get 46 percent available. I hav a galaxy s i9000 and i previously used to get 256 out of 512 by trying differnet kernel. Then i got 409.
 
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#10
Originally Posted by Hurrian View Post
This is kinda risky - if you ever forget that the N900 now depends on a microsd on a specific partition for Swap, Maemo will start *****ing about not enough memory (not true, can launch xterm).
That is absolutely true.
And editing critical system files may bail out a few noob's N900

I do use a different approach:
put a script in event.d,
that checks for existence of my swap file (yes, I do use a swap file on standard vFAT SD partition (too lazy for repartitioning)), could also check for existence of partition.
then enable the swap as loopback device with higher priority (using bb power's swapon or also possible debians swapon). This way at startup eMMC swap is used, around 4-5MB, and then swap only on SD.
If you want to cleanup swap, just 'swapoff mmc' and it uses eMMC swap. If I want to use again swap on SD, just enable it with higher priority 'swapon mmc -p 0'. This assures also that swap is available even no or another SD is available.

As my script is highly customized to my needs ( starting python maps server, mounting maps in a loopback file, checking for other stuff) I am not going to post it here (in its current state) ...

I am not sure that using loopback as swap is faster (better) than using eMMC swap, but as there are no tools yet to confirm, it is just subjective opinion.
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 20:37.