maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   [DISCUSS] SDCard Swap Partition Methods.. (https://talk.maemo.org/showthread.php?t=84296)

sulu 2012-07-05 06:52

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by sixwheeledbeast (Post 1232062)
Would there be any benefits in having 2 swap spaces on Micro SD?
Leaving the standard swap space as backup (for no card inserted).
Maybe use cron to Swap between the SD Swaps at night?

That depends on what you consider to be a benefit.
If you don't need these additional 768MB on your emmc it doesn't hurt to keep the stock swap partition anyway.
Changing between swap partitions via a cron essentially does what Estel's ereswap does if you set it up to automatically switch the partition, so it has the same pros and cons:
pro: You get a "fresh" swap every morning.
con: Each copy of the swap contents means another writing process on a fairly limited amount of flash cells, eventually decreasing the cell's lifetime. But I don't think that's an issue unless you intend to keep your N900 for a decade or so.

reinob 2012-07-05 07:06

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by michaaa62 (Post 1228579)
Very interesting! Please keep informing on your proceedings.

Well, the time I can dedicate to this is severly limited :), but at the moment I have removed a whole bunch of stuff from a standard PR1.3 install and copied the whole rootfs to a folder under /home (which I partitioned to be 8GB).

Now I'm working on making a version of KP50 with many modules built-in so that it can boot via U-boot without needing an initrd or anything from the NAND chip.

That'll take some time though..

sixwheeledbeast 2012-07-05 18:05

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by sulu (Post 1232191)
con: Each copy of the swap contents means another writing process on a fairly limited amount of flash cells, eventually decreasing the cell's lifetime. But I don't think that's an issue unless you intend to keep your N900 for a decade or so.

This is why I am thinking of using only Micro SD swap but two of them. I do plan to reduce the wear on the N900's flash in doing this.

If there both on the SD, I only have to switch between the swaps (swap2 on, swap1 off) compared to a full reswap (swap2 on, swap1 off, swap1 on then swap2 off).

On my 64Gb card I am thinking 2x 800Mb swap spaces, 5Gb Document partition and whatever's left for a Music partition.

Can anybody see any issues I may come across with this?

With music on the card I am hoping for smooth multi tasking while playing music under heavy load.

misiak 2012-07-06 06:56

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by sixwheeledbeast (Post 1232517)
On my 64Gb card I am thinking 2x 800Mb swap spaces, 5Gb Document partition and whatever's left for a Music partition.

Can anybody see any issues I may come across with this?

With music on the card I am hoping for smooth multi tasking while playing music under heavy load.

You will reduce wear, but having files on microsd and swap on microsd it can still lag as hell (same situation as swap on internal flash + files on internal flash), as the microsd controller will have conflicts on writing/reading to swap and files partition (I hope you understand what I mean).

sulu 2012-07-06 07:56

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Music (read-only) and documents (small files, very few writes) shouldn't cause much trouble if they are on the SD card with the swap partition. Of course there may still be conflicts but the device should be able to handle them.
I have swap and (mostly) music on my SD card and almost never experience any hickups.

sixwheeledbeast 2012-07-06 21:52

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by misiak (Post 1232764)
(I hope you understand what I mean).

This was exactly what I was getting at as reguard to issues.

Quote:

Originally Posted by sulu (Post 1232776)
Music (read-only) and documents (small files, very few writes) shouldn't cause much trouble if they are on the SD card with the swap partition.

This is what I was thinking.

I can test the different methods and check for conflicts.
Starting with ideal for less N900 wear and adjust until happy.
Time will tell.

Are there any recommendations for Swappolube settings with swap on uSD or will it depend on the card?

sixwheeledbeast 2012-07-10 22:35

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Well my 64GB card arrived and so far so good.
No issues with lag and the system feels snapier at the moment.

I made two swaps of 800mb (1p2 and 1p3) and the rest FAT32 (1p1).

To start swap on MMC I created a file in event.d

etc/event.d/relocateswap
Code:

description "Micro SD Swap Location on Startup"
author "sixwheeledbeast"

console output

start on started rcS-late

script
        swapon /dev/mmcblk1p2       
        sleep 10
        swapoff /dev/mmcblk0p3
end script

It seems (from testing) if the memory card is not accessable the script can not run and swap goes on (0p3) as per rcS-late.

Also I have added three QBW to view current swaps and swap between swap spaces.

Check Swaps
Code:

cat /proc/swaps | awk '/dev/ {print $1}'
The other two buttons are swap 1p2 on, swap 1p3 off and vice versa.
I am hoping when I have time to turn this into one script that can be run from cron or QBW etc.

Ideally something like:

if swap = 1p2 then swap on 1p3, swap off 1p2
if swap =1p3 then swap on 1p2, swap off 1p3
if swap = 0p3 then swap on 1p2, swap off 0p3
with some way of knowing if it's failed or not possible.

I would just use ereswap but that would defeat the object of lowering flash wear by only swapping one way.

Raimu 2012-07-10 22:46

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Hee, that's a nice looping swap. Not just wear, this also should shorten the swapoff/on refresh slowness a fair bit since this ring moves the swap one way.

Estel 2012-07-11 01:29

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by sixwheeledbeast (Post 1235661)
I would just use ereswap but that would defeat the object of lowering flash wear by only swapping one way.

Why so? In ereswap config, uou can define both main and "backup" swap as partitions on microSD ,(mmcblk1p2 and mmcblk1p3 in this case) which leaves internal swap out of use (it can even not exist) making it fully compatible with your use case :)

/Estel

sixwheeledbeast 2012-07-11 16:56

Re: [DISCUSS] SDCard Swap Partition Methods..
 
Quote:

Originally Posted by Raimu (Post 1235669)
Not just wear, this also should shorten the swapoff/on refresh slowness a fair bit since this ring moves the swap one way.

Exactly :D

Quote:

Originally Posted by Estel (Post 1235733)
Why so? In ereswap config, you can define both main and "backup" swap as partitions on microSD ,(mmcblk1p2 and mmcblk1p3 in this case) which leaves internal swap out of use (it can even not exist) making it fully compatible with your use case :)

Compatible yes, but not exactly my plan.

My idea of having two swaps on microSD is so they can be used equally.
With ereswap IINM you can only have a primary and a temporary swap space.
I wish to have two swaps which I can "flip/flop" to.

The benefit's are quicker swap refresh and reduced, equal cell usage.


All times are GMT. The time now is 07:22.

vBulletin® Version 3.8.8